window close event

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • abhay

    window close event

    Hello all,

    I want to trap the window.close() event when the user clicks on the
    close button of the browser using javascript.
    Can anyone shed light on this problem ?

    Thanks in advance.

    regards
    casper
  • Lasse Reichstein Nielsen

    #2
    Re: window close event

    casper_2000@red iffmail.com (abhay) writes:
    [color=blue]
    > I want to trap the window.close() event when the user clicks on the
    > close button of the browser using javascript.[/color]

    Can't be done consistently across browsers.
    In IE, you can use the proprietary "onbeforeunload " handler to
    do something before the window is closed. You can even request
    that the window is not closed, by returning a string. That string
    is shown to the user, who can then decide whether to close the
    window or not.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...