This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

how to detect mozilla firefox window close using javascript

  • 1 reply
  • 29 have this problem
  • 16 views
  • Last reply by Svetlana

more options

how can i call javascript function when close the browser window? I mean which event is triggered when closing the window..

how can i call javascript function when close the browser window? I mean which event is triggered when closing the window..

All Replies (1)

more options
  • unload

This event is sent to a window when the window has closed. This is done after the close event. You should place this event handler on the window element. attribute: onunload

  • close

This event is sent when a request has been made to close the window when the user presses the close button. If you place an event handler on the window element, you can trap the window close. If you return false from the close handler, the window will not close. Return true to have it close normally. Note that this event is only fired when the user presses the close button on the titlebar; use the unload event to capture all attempts to unload the window. attribute: onclose

https://developer.mozilla.org/en/XUL/Events