You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!
The WindowEventHandlers
mixin describes the event handlers common to several interfaces like Window
, or HTMLBodyElement
and HTMLFrameSetElement
. Each of these interfaces can implement additional specific event handlers.
Note: WindowEventHandlers
is a mixin and not an interface; you can't actually create an object of type WindowEventHandlers
.
Properties
The events properties, of the form onXYZ
, are defined on the WindowEventHandlers
, and implemented by Window
, and WorkerGlobalScope
for Web Workers.
WindowEventHandlers.onafterprint
- Is an
EventHandler
representing the code to be called when theafterprint
event is raised. WindowEventHandlers.onbeforeprint
- Is an
EventHandler
representing the code to be called when thebeforeprint
event is raised. WindowEventHandlers.onbeforeunload
- Is an
EventHandler
representing the code to be called when thebeforeunload
event is raised. WindowEventHandlers.onhashchange
- Is an
EventHandler
representing the code to be called when thehashchange
event is raised. WindowEventHandlers.onlanguagechange
- Is an
EventHandler
representing the code to be called when thelanguagechange
event is raised. WindowEventHandlers.onmessage
- Is an
EventHandler
representing the code to be called when themessage
event is raised. WindowEventHandlers.onmessageerror
- Is an
EventHandler
representing the code to be called when theMessageError
event is raised. WindowEventHandlers.onoffline
- Is an
EventHandler
representing the code to be called when theoffline
event is raised. WindowEventHandlers.ononline
- Is an
EventHandler
representing the code to be called when theonline
event is raised. WindowEventHandlers.onpagehide
- Is an
EventHandler
representing the code to be called when thepagehide
event is raised. WindowEventHandlers.onpageshow
- Is an
EventHandler
representing the code to be called when thepageshow
event is raised. WindowEventHandlers.onpopstate
- Is an
EventHandler
representing the code to be called when thepopstate
event is raised. WindowEventHandlers.onrejectionhandled
- Is an
EventHandler
representing the code to be called when therejectionhandled
event is raised, indicating that aPromise
was rejected and the rejection has been handled. WindowEventHandlers.onstorage
- Is an
EventHandler
representing the code to be called when thestorage
event is raised. WindowEventHandlers.onunhandledrejection
- Is an
EventHandler
representing the code to be called when theunhandledrejection
event is raised, indicating that aPromise
was rejected but the rejection was not handled. WindowEventHandlers.onunload
- Is an
EventHandler
representing the code to be called when theunload
event is raised.
Methods
This interface defines no method.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'WindowEventHandlers' in that specification. |
Living Standard | No change since the latest snapshot, HTML 5.1. |
HTML 5.1 The definition of 'WindowEventHandlers' in that specification. |
Recommendation | Snapshot of HTML Living Standard. Added onlanguage since the HTML5 snapshot. |
HTML5 The definition of 'WindowEventHandlers' in that specification. |
Recommendation | Snapshot of HTML Living Standard. Creation of WindowEventHandlers (properties where on the target before it). |
Browser compatibility
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
WindowEventHandlers | Chrome Full support Yes | Edge Full support Yes | Firefox Full support Yes | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
onafterprint | Chrome Full support 63 | Edge Full support Yes | Firefox Full support 6 | IE Full support Yes | Opera Full support 50 | Safari No support No | WebView Android Full support 63 | Chrome Android Full support 63 | Firefox Android ? | Opera Android Full support 46 | Safari iOS ? | Samsung Internet Android ? |
onbeforeprint | Chrome Full support 63 | Edge Full support Yes | Firefox Full support 6 | IE Full support Yes | Opera Full support 50 | Safari No support No | WebView Android Full support 63 | Chrome Android Full support 63 | Firefox Android ? | Opera Android Full support 46 | Safari iOS ? | Samsung Internet Android ? |
onbeforeunload | Chrome Full support 1 | Edge Full support Yes | Firefox Full support 1 | IE Full support 4 | Opera Full support 12 | Safari Full support 3 | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android ? | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
onhashchange | Chrome Full support 5 | Edge Full support Yes | Firefox Full support 3.6 | IE Full support 8 | Opera Full support 10 | Safari Full support 5 | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support 4 | Opera Android Full support 10.1 | Safari iOS Full support 5 | Samsung Internet Android ? |
onlanguagechange | Chrome Full support 37 | Edge ? | Firefox Full support 32 | IE No support No | Opera Full support 24 | Safari ? | WebView Android Full support 37 | Chrome Android Full support 37 | Firefox Android Full support 4 | Opera Android Full support 24 | Safari iOS ? | Samsung Internet Android ? |
onmessage | Chrome Full support 60 | Edge ? | Firefox ? | IE ? | Opera Full support 47 | Safari ? | WebView Android Full support 60 | Chrome Android Full support 60 | Firefox Android ? | Opera Android Full support 44 | Safari iOS ? | Samsung Internet Android ? |
onmessageerror | Chrome Full support 60 | Edge ? | Firefox Full support 57 | IE ? | Opera Full support 47 | Safari ? | WebView Android Full support 60 | Chrome Android Full support 60 | Firefox Android Full support 57 | Opera Android Full support 44 | Safari iOS ? | Samsung Internet Android ? |
onpopstate | Chrome Full support 5 | Edge Full support 12 | Firefox Full support 4 | IE Full support 10 | Opera Full support 11.5 | Safari Full support 6 | WebView Android Full support 37 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support 11.5 | Safari iOS Full support 5.1 | Samsung Internet Android ? |
onrejectionhandled | Chrome Full support 49 | Edge ? | Firefox
Full support
69
| IE No support No | Opera Full support 36 | Safari Full support 11 | WebView Android Full support 49 | Chrome Android Full support 49 | Firefox Android
Full support
68
| Opera Android No support No | Safari iOS Full support 11.3 | Samsung Internet Android ? |
onstorage | Chrome Full support 1 | Edge Full support Yes | Firefox Full support 45 | IE ? | Opera Full support 15 | Safari ? | WebView Android Full support ≤37 | Chrome Android Full support 18 | Firefox Android Full support 45 | Opera Android Full support 14 | Safari iOS ? | Samsung Internet Android ? |
onunhandledrejection | Chrome Full support 49 | Edge ? | Firefox
Full support
69
| IE No support No | Opera Full support 36 | Safari Full support 11 | WebView Android Full support 49 | Chrome Android Full support 49 | Firefox Android
Full support
68
| Opera Android No support No | Safari iOS Full support 11.3 | Samsung Internet Android ? |
onunload | Chrome Full support Yes | Edge Full support Yes | Firefox Full support Yes | IE Full support Yes | Opera Full support Yes | Safari Full support Yes | WebView Android Full support Yes | Chrome Android Full support Yes | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android ? |
Legend
- Full support
- Full support
- No support
- No support
- Compatibility unknown
- Compatibility unknown
- Experimental. Expect behavior to change in the future.
- Experimental. Expect behavior to change in the future.
- See implementation notes.
- See implementation notes.
- User must explicitly enable this feature.
- User must explicitly enable this feature.