Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Jun 2008
    Posts
    102
    Thanks
    6
    Thanked 9 Times in 9 Posts

    How to window.close() and prevent the confirm that comes up?

    Not sure where to put this but the general section should be okay.

    say you have a link like

    <a href="javascript: window.close()">Close</a>

    when you click on it, the browser asks you if you want to let script allow the window to close.

    Is there a way to prevent the confirm box from comming up, and just close it.

    If there is a solution, is it the same for a parent window and for a child window (one that the parent creates)?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    Quote Originally Posted by hotwheelharry View Post
    Not sure where to put this but the general section should be okay.

    say you have a link like

    <a href="javascript: window.close()">Close</a>

    when you click on it, the browser asks you if you want to let script allow the window to close.

    Is there a way to prevent the confirm box from comming up, and just close it.
    If there is a solution, is it the same for a parent window and for a child window (one that the parent creates)?

    No, this is a security featute which cannot be over-ridden.

  • #3
    Regular Coder
    Join Date
    Jun 2008
    Posts
    102
    Thanks
    6
    Thanked 9 Times in 9 Posts
    I've seen it done before, but only with the window that was created with a script. It's usually at the bottom of Terms of Use or Privacy Policy pop-ups.

    So I know that's possible. Do you know how to do that?

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,990
    Thanks
    203
    Thanked 2,536 Times in 2,514 Posts
    You can guess that this topic has been dealt with before.

    avoid popup window when closing explorer

    Close window alert message

    I think the method listed above does not work in IE6+.
    Last edited by Philip M; 06-13-2008 at 04:17 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •