Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Checking a frame URL before action

    Hi All,

    I have a frameset with 2 frames as follows - mainFrame(top) and bottomFrame(bottom).

    In the bottomFrame I have a link to open a new window - but I want to check what the URL is of the mainFrame (its a login page) to ensure they have logged in (ie not sitting on the login page).

    I have tried the code below and different variations but can't get it to work (probably because I don't really know what I'm doing).

    Nay help would be appreciated.

    <html>
    <head>
    <script language="JavaScript">
    function check(){

    if (window.mainFrame.location.href = "http://testpage.jsp"){
    alert("Please login to testpage first.");
    }else{
    return TRUE;
    }
    }

    </script>

    </head>

    <body>
    <table align="center" width="200" border="0" cellpadding="0" cellspacing="0">
    <tr>
    <td align="center" valign="top" class="10bl">
    <a href="default.asp" target="nnew" onClick="check()"><font class="10bl" ><b>Page to View</b></font></a>
    </td>
    </tr>
    </table>
    </body>
    </html>

    Cheers
    BVT.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,074
    Thanks
    0
    Thanked 256 Times in 252 Posts
    Since you're using a server-side language (ASP or JSP?), it's better that you check the login status there and not in the client-side which is not secure.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Jun 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Will give it a go - thanks Glenn.
    BVT.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •