Solved

OnUnload for a frameset

Posted on 2000-05-04
5
930 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Validating Date 4 28
Javascript Regex 7 20
Timer on div 5 22
Adding 1 the value of input "text" every 3 seconds 5 32
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
The viewer will learn how to count occurrences of each item in an array.

713 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