View Full Version : Checking a frame URL before action

08-13-2004, 03:15 AM
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.

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

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



<table align="center" width="200" border="0" cellpadding="0" cellspacing="0">
<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>


08-13-2004, 04:23 AM
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.

08-15-2004, 10:30 PM
Will give it a go - thanks Glenn.