Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   JavaScript and Client-Side Browser Scripting (http://www.programmingforums.org/forum23.html)
-   -   Closing A Window Via Javascript (http://www.programmingforums.org/showthread.php?t=244)

Infinite Recursion Jul 29th, 2004 2:09 PM

I'm wanting to close a window (the main browser) with javascript... this is what I have.

javascript:window.close();


It works. But, I do not want it to prompt the user to confirm the closure. I want it to close without the dialog box comming up. Do you guys know of a work around for this?

Mjordan2nd Jul 29th, 2004 2:30 PM

Usually if you have more than one location in the window's histiory, the message will pop up.

I'm not sure if this will work, but try this:

window.opener = null (or window.opener = self)
window.close()
return false


Let me know if that works.

scientica Jul 29th, 2004 3:56 PM

iirc it's a browser feature - sort of, "a script is trying to close this windows, is this ok with you, user?".

Infinite Recursion Jul 29th, 2004 9:42 PM

Thanks for your inputs.

Come to find out the close() will only work if the open() created the window... and in this case, it didn't.


All times are GMT -5. The time now is 12:46 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC