An event handler for close events sent to the window. (Not available with Firefox 2 or Safari)

Syntax

window.onclose = funcRef;

Parameters

  • funcRef is a reference to a function.

Example

window.onclose = resetThatServerThing;

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'onclose' in that specification.
Living Standard  

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes ? Yes ? ? No
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes ? Yes ? No ?

Document Tags and Contributors

Last updated by: fscholz,