Click to See Complete Forum and Search --> : parent child problem


bloke
09-03-2003, 04:27 AM
Hello guys

I have an asp page in which session variables are set. These are then used in the proceeding page then killed (this has been done this way for various reasons which I don't need to go into!).

I've realised that if the session variables are set in the first page but instead of the user clicking the proceed button, they close the window altogther, the session variable is not killed which could cause problems.

What I want to do is open a new window onunload, no problem, but I then want the child window to check if the subsequent window exists, if not then kill the session variable and close itself. The parent window is purchase.asp and the user should proceed to purchase1.asp. If purchase1.asp exists then I simply want the child window to close itself without taking any action.

I hope this makes sense and I haven't rambled too much!

Cheers

bloke
09-03-2003, 05:45 AM
Originally posted by bloke
What I want to do is open a new window onunload, no problem, but I then want the child window to check if the subsequent window exists, if not then kill the session variable and close itself.

Ok, I've figured the first bit out but what I have now is:

<SCRIPT LANGUAGE=javascript>
if ((window.opener.location.href) == 'http://aUrl/apage.asp')
{
window.close();
}
else
{
//set session variable to empty
}
</script>

Some help would be greatly appreciated.

Cheers