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 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    pop-up that closes parent window

    I have an exit window on a web page, when clicked it has a question asking if you are sure you want to exit this site, with buttons for yes and no. I would like the yes button to close botht the pop up and the parent window, and no to just close the pop-up. How would I go about doing this?

    Thanks

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    Wichita
    Posts
    3,880
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    window.opener.close();window.close();
    Good practice though is to never close a window you didn't open, the user can use the regular window close mechanism to close any window they want at the time they want and trying to close any window you didn't open is going to cause the user to get asked if they want that window to be closed.

    That extra prompt can be bypassed but that's a bug you can't count on being there so don't bother with trying to take advantage of it because while it'll make your website look smooth now it'll be fixed someday and then your website will look awkward.

    Some good advice: http://evolt.org/article/I_am_USER_h...295/index.html


    EDIT: Had to fix my code a bit
    Last edited by Roy Sinclair; 03-15-2004 at 05:20 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.


  •  

    Posting Permissions

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