Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.close message 2

Status
Not open for further replies.

jby1

Programmer
Apr 29, 2003
403
GB
Hi

I am wanting to have a button which closes a browser window. There is an application message which asks them if they are sure they wish to close it. If they are sure then window.close() is called.

However, I am finding that when I call window.close, a message pops up asking if I want to close the window!

Is it possible to supress this message?

Thank you.
 
The only way to avoid that message is to create the window that is calling the window.close() method.

An example would be your main screen pops open a new window.

<body onLoad=&quot;window.open('myscreen.htm','myscreenName','')>


The new window (&quot;myscreenName&quot;) can call the window.close() method without the warning.

Otherwise there is no way around the message.

Good Luck!

Wow JT that almost looked like you knew what you were doing!
 
Ah well, it looks like they will just have to live with it then!

Thanks anyway!
 
Here is a javascript function to do what you want.

function cmdExit()
{
window.parent.opener=null;
window.parent.close();
}
 
That worked a treat! Thanks!!!
 
I very gladly stand corrected! That's great!

A star for you Careyson!

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top