close and open, same time

They have: 25 posts

Joined: Sep 1999

hello everyone,
Situation:
When clicking in a link this window will close and another will open.
Problem:
How can I get this without the browser poping up a mensage asking me if I want to close this window ?

Here is the code that I'm using.
Can samebody check what I need to do.
---------------------------------
<SCRIPT LANGUAGE="JavaScript">
<!-- Masquer le script
function ouvrir(num)
{if (num==1) window.open('home.htm', 'hello' , 'width=780,height=530,toolbar=no,location=no,directories=no,menubar=no,resizable=no,scrollbars=no');
}
// cesser -->
</SCRIPT>

<A HREF="javascript uvrir(1);window.close()">home</a>
---------------------------------

John Pollock's picture

He has: 628 posts

Joined: Mar 1999

When the code tries to close the original browser window, the computer sees it as a security risk and displays the message. Unfortunately, I don't know a way around it, and I'm not sure there should be as it well could cause a security risk of some kind.

However, if anyone does know the way, please post it. There are alot of others looking for it as well.

They have: 25 posts

Joined: Sep 1999

Thanks John
Hope that someone knows it.

They have: 89 posts

Joined: Sep 1999

The only way to avoid getting the message when closing any window is when a you close a window that only has one location in its history. In other words, if the users main browser window has a history greater than 1 (which it will) if will prompt for the message. You can use the replace() method to overwrite the last location, but I don't know of any way to force the browser to clear the history and I am fairly certain it has been designed so that this is not supposed to be possible. Of course, I am sure that there is some way to do this with a tricky ActiveX control or something, but not worth the time.

They have: 25 posts

Joined: Sep 1999

Thanks RC,
good esplanation
anyway I can wait for a tricky activeX.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.