Link to home
Start Free TrialLog in
Avatar of kprameela
kprameela

asked on

OnUnload for a frameset

In frameset tag I have fired window.open method onunload event handler. It is working with explorer browser but not with Netscape navigator.
What might be the reason?? If I am giving other commands such as alert statement instead of window.open then it is working in Netscape also. Please give me a solution. It is showing that that "Illegal URL method" along with the url, which I want to try to open by window.open().
Avatar of CJ_S
CJ_S
Flag of Netherlands image

In Netscape you cannor prevent a user from closing the browser, the same goes for the onunload. You cannot force the user, when he wants to quit a certain frameset (which is seen as closing the browser), to open up a new page.

A solution might be to use a function which opens up the new browser window or whatsoever. But big chance that that won't work...
Avatar of Michel Plungjan
Netscape wants a complete url in the onUnload because often the knowlegde of the page like where it came from is already gone from memory.

<frameset onUnload="window.open('http://www.myserver.com/','newwindow')">

Michel
Avatar of kollegov
kollegov

If you want not to allow to close window. I'd use the following:

<frameset onUnload="window.open(document.location,'newwindow')">

This will just reopen document again in new window.
( And this work :)

attempt to cancel  close window
is  what Netscape corporation consider 'bad practise' and therefore not allow to do.
I think you hardly will find any surfer on the net who consider this policy wrong...
ASKER CERTIFIED SOLUTION
Avatar of dplambert
dplambert

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
DP: You are again answering with an answer that is already in the comments - please do not do that. Feel free to add comments and have your comments accepted as answers, but if there are already valid comments, please do not answer

Michel