Solved

OnUnload for a frameset

Posted on 2000-05-04
5
888 Views
Last Modified: 2013-11-19
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().
0
Comment
Question by:kprameela
5 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 2776543
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...
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2776600
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
0
 
LVL 10

Expert Comment

by:kollegov
ID: 2776795
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...
0
 
LVL 3

Accepted Solution

by:
dplambert earned 200 total points
ID: 2778420
I built a simple frameset and tried an experiment. I was able to get the following piece of code to work in Netscape 4.72 and IE 5.0:

<frameset onUnload="window.open('test.html', 'newWin');">

When I hit reload (calls unLoad), it properly opened 'test.html' in a new window.

Your error message tells me that your event was handled. Perhaps you didn't correctly pass your parameters to the window.open() method.

It's:

window.open( URL, name, parameters );

For example:

window.open('http://www.test.com/test.html', 'newWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600,height=400');
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2778491
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
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now