How can i know when user clicks X button of the browser ?

Discussion in 'Javascript' started by Asit, Apr 26, 2004.

  1. Asit

    Asit Guest

    How can i know when user clicks X button of the browser ?
    I have to write some code when user clicks X button of browser. What is the
    event for capturing this event ?

    Help needed ASAP.

    Asit
     
    Asit, Apr 26, 2004
    #1
    1. Advertising

  2. On 25 Apr 2004 21:08:11 -0700, Asit <> wrote:

    > How can i know when user clicks X button of the browser ?


    The unload event fires when the document unloads, but a document can
    unload for many things not just closing. Furthermore, some browsers don't
    fire the unload event during closing, which makes it an even more
    unreliable approach.

    > I have to write some code when user clicks X button of browser. What is
    > the event for capturing this event ?


    If the user is closing their browser, it is generally too late for you to
    be doing anything. What are you trying to accomplish? There might be an
    alternate way.

    Mike

    --
    Michael Winter
    d (replace ".invalid" with ".uk" to reply)
     
    Michael Winter, Apr 26, 2004
    #2
    1. Advertising

  3. Asit wrote:

    > How can i know when user clicks X button of the browser ?


    You cannot.

    > I have to write some code when user clicks X button of browser.


    You don't have to.

    > What is the event for capturing this event ?


    There is no standard compliant one that works cross-browser.

    > Help needed ASAP.


    Refactor your server-side application, if you use any; do
    not nag your users, if you do not. The latter is illegal.


    PointedEars
     
    Thomas 'PointedEars' Lahn, May 5, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Bucky
    Replies:
    1
    Views:
    13,900
    Bucky
    May 19, 2005
  2. Mossman
    Replies:
    1
    Views:
    563
    cbDevelopment
    Dec 12, 2005
  3. PontiMax

    Clicks and double-clicks

    PontiMax, Jul 14, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    2
    Views:
    204
    Eliyahu Goldin
    Jul 14, 2004
  4. morc
    Replies:
    4
    Views:
    187
    Thomas 'PointedEars' Lahn
    Feb 14, 2006
  5. Replies:
    6
    Views:
    112
Loading...

Share This Page