...

View Full Version : Use window object across pages...



tecman
01-09-2003, 08:17 PM
Hi
When I access a page (page1), this page opens a new page(page2), when this page is closed it opens a new page (page3) with 'onunload'. How do I get page3 to alter the location of page1.

/SB

Algorithm
01-09-2003, 11:06 PM
You can't. The only way you could access page1 is via page2, so if you close page2, you're stuck.

mordred
01-09-2003, 11:25 PM
Before you close page2, you can pass the opener reference to page3 and so it might be possible to change window1 from page3. I say might because I haven't tested this, and don't know if the variable pertains after page2 has been closed. Try it out.

tecman
01-10-2003, 10:04 AM
Hi both

I've testet it and I knew that I could reach page 1 if I had page 2 open the trick is that Page3 only opens when page2 is closed....
And the bad thing is it's a must... Is it not a posibility to make an object which is reachable to all pages open who knows the object name, whitout any reference sendt between pages?
I hope or then I'll have to make one :)

tecman
01-10-2003, 10:55 AM
Hi again

I've reached a soloution...

when page2 is opened it sets a var closed = 'true' and when my page is closed I alter the location of Page1 but if page2 just clicks a link onUnload will still execute but before var closed will be set to 'false' and page1 will not be altered:

onUnload="isclosed()"
........
var closed = true
........
function isclosed(){
if(closed)
window.opener.location="newlocation.html"
}
....
<a href="page.html" onclick="closed=false">link</a>


hope it helps others in the same problem...
thanks for your help both of you!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum