SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Dec 2005
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Prompting user before closing the browser

    Hey everyone,

    Does anyone know how to make it prompt the user if they try to close the browser window? Basically if someone goes to file->exit, or tries to navigate to another site, I want a confirmation box to pop up and say are you sure?

    Please note I am not using this to annoy regular visitors - this is only going to be a part of my admin panel where I frequently forget to complete the last step, I just want to add a friendly reminder for myself.

    Thanks,
    Kevin

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    there is the onunload event which is called each time the location changes or the window closes. But this is called even if your going to a new page within your own site.


  3. #3
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.


Bookmarks

Posting Permissions

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