Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

JavaScript ONUNLOAD event

Trying to make a 'smart' uncloseable window...



9:45 pm on Apr 4, 2002 (gmt 0)

10+ Year Member

Hello. I am trying to use the onUnload event to create an uncloseable window. The only problem is that the event does not only trigger when the window is closed, but also when the user refreshes or navigates away from the document. I need to find a way to circumvent this, and spawn a new window if (and only if) the parent window is closed. I have tried everything from checking self.opener and setting session cookies (which apparently do not work across child windows..) Does anyone have any ideas that I might have missed?



9:47 pm on Apr 4, 2002 (gmt 0)

WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

the only way I have seen it done is with the onUnload event on a full size external frame. This way the navigation isn't effected but if you leave the site it triggers the onUnload.


10:28 pm on Apr 4, 2002 (gmt 0)

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

Welcome to the forums.

I might have some ideas, weasel, but first send me the URL via Sticky Mail (top of the page) - so I can be sure never to visit that site ;)

Either that, or tell us why you want to overrule your visitor's wishes with such a heavy hand.


7:04 pm on May 16, 2002 (gmt 0)

10+ Year Member

Hehehe.. Actually, it's not for subversive purposes.. It is for an internal company web page at the call center I work at.. The page contains information on particular clients, valuable resources for the employees, but some of them inevitably close the browser window. The goal is to have it re-open, but only in the event that it is closed..

To top it all off, I set up the page to refresh automatically every 10 minutes to reflect any changes I made, and as a result during my experiments some of the terminals ended up with 15 or 20 browser windows open by the end of the shift.. :)



Featured Threads

Hot Threads This Week

Hot Threads This Month