Script to warn before leave page - Somebody help me

Discussion in 'JavaScript' started by LanZord, Jun 15, 2009.

  1. #1
    Please somebody take a look at this site unlock-the-iphone.com

    Is it using javascipt? Anyone know how to make it..

    Thanks for helping..:)
     
    LanZord, Jun 15, 2009 IP
  2. Unni krishnan

    Unni krishnan Peon

    Messages:
    237
    Likes Received:
    9
    Best Answers:
    2
    Trophy Points:
    0
    #2
    I saw the site but was not able to crack the mechanism by which they are implementing this.
    You can trigger a javascript function on the 'onunload' event but it will cause that function to be performed each time the page is refreshed, closed or when u navigate to other place.

    Here is a code that detects browser close in IE.
    But it won't work if you navigate to a different page.(using a link or address bar, or refresh using mouse.)

    But i think you can do this using AJAX and some server-side languages.

    Hope this helps.
     
    Unni krishnan, Jun 15, 2009 IP
  3. James Barcellano

    James Barcellano Active Member

    Messages:
    114
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    This is not achievable using server side code, this will have to be javascript.
     
    James Barcellano, Jun 17, 2009 IP