SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    command called on quit?

    I know this is possible, I want to make a prompt for the user when he quits. That I know, but is there a special command called when the user quits. Maybe I can change that function or something?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    The onUnload event of the body tag.

    Code:
    <body onUnload="function()">

  3. #3
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was expecting that to work and it does, but when I press Cancel it still quits, I'm guessing because it unloads then calls the function. Can I cancel the quit inside my quit() function? Also, I want it to do that only when you click quit, right now it does it when you click a link

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    What does "click quit" mean? My web browser is closed by clicking the X in the upper right, double clicking its icon in the upper left, going File > Exit, or pressing alt+f4. And you can't stop me from doing any of those things.

  5. #5
    SitePoint Evangelist Jedi007's Avatar
    Join Date
    Aug 2005
    Posts
    463
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    whoa! I'm not trying to stop you, I just want to make a thing where you click X or alt-f4 or whatever, and it prompts are you sure you want to quit? Just because they might click it by accident and then lose all the work you do on that page. Comprendo?

    PS: GMail does it


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
  •