Results 1 to 2 of 2

Thread: Need javascript code for BROWSER window control

  1. #1
    Join Date
    Aug 2010

    Need javascript code for BROWSER window control

    Hey javascript experts, haven't been able to figure this one out:

    I have a site where I need the javascript code to insert onto my homepage for the following:

    When a user wants to exit the entire site from clicking the browser, (the 'X' CLOSE window)
    how do I set a confirmation box to pop up to confirm navigation away from the page, and maybe offer 2 options "Close the window" or "Stay on this Page". If a user opts to stay on the page, I'd then want to link to an invisible page on the same site.
    I've seen this on several sites and it's not specific to any browser apparently it's in the code for the sites.

    Thanks mucho guys!

  2. #2
    Join Date
    Aug 2007
    Google window.onbeforeunload and window.onunload, oceans of examples. It's not guaranteed to work, Opera in particular disables it completely I think.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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