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
EventHandlerrepresenting the code to be called when theafterprintevent is raised. WindowEventHandlers.onbeforeprint- Is an
EventHandlerrepresenting the code to be called when thebeforeprintevent is raised. WindowEventHandlers.onbeforeunload- Is an
EventHandlerrepresenting the code to be called when thebeforeunloadevent is raised. WindowEventHandlers.onhashchange- Is an
EventHandlerrepresenting the code to be called when thehashchangeevent is raised. WindowEventHandlers.onlanguagechange- Is an
EventHandlerrepresenting the code to be called when thelanguagechangeevent is raised. WindowEventHandlers.onmessage- Is an
EventHandlerrepresenting the code to be called when themessageevent is raised. WindowEventHandlers.onmessageerror- Is an
EventHandlerrepresenting the code to be called when theMessageErrorevent is raised. WindowEventHandlers.onoffline- Is an
EventHandlerrepresenting the code to be called when theofflineevent is raised. WindowEventHandlers.ononline- Is an
EventHandlerrepresenting the code to be called when theonlineevent is raised. WindowEventHandlers.onpagehide- Is an
EventHandlerrepresenting the code to be called when thepagehideevent is raised. WindowEventHandlers.onpageshow- Is an
EventHandlerrepresenting the code to be called when thepageshowevent is raised. WindowEventHandlers.onpopstate- Is an
EventHandlerrepresenting the code to be called when thepopstateevent is raised. WindowEventHandlers.onstorage- Is an
EventHandlerrepresenting the code to be called when thestorageevent is raised. WindowEventHandlers.onunhandledrejection- An event handler for unhandled
Promiserejection events. WindowEventHandlers.onunload- Is an
EventHandlerrepresenting the code to be called when theunloadevent is raised.
Methods
This interface defines no method.
Specifications
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'GlobalEventHandlers' in that specification. |
Living Standard | No change since the latest snapshot, HTML 5.1. |
| HTML 5.1 The definition of 'GlobalEventHandlers' in that specification. |
Recommendation | Snapshot of HTML Living Standard. Added onlanguage since the HTML5 snapshot. |
| HTML5 The definition of 'GlobalEventHandlers' 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 ? | Firefox Full support Yes | IE ? | Opera Full support Yes | Safari ? | WebView Android Full support Yes | Chrome Android Full support Yes | Edge Mobile ? | Firefox Android Full support Yes | Opera Android Full support Yes | Safari iOS ? | 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 | Edge Mobile Full support Yes | Firefox Android ? | Opera Android Full support 50 | 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 | Edge Mobile Full support Yes | Firefox Android ? | Opera Android Full support 50 | 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 | Edge Mobile Full support Yes | Firefox Android ? | Opera Android Full support Yes | Safari iOS
No support
No
| 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 | Edge Mobile Full support Yes | Firefox Android Full support 4 | Opera Android Full support 11 | 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 | Edge Mobile ? | 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 | Edge Mobile ? | Firefox Android ? | Opera Android Full support 47 | 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 | Edge Mobile ? | Firefox Android Full support 57 | Opera Android Full support 47 | 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 ? | Chrome Android Full support 18 | Edge Mobile ? | Firefox Android Full support 4 | Opera Android Full support 12 | Safari iOS Full support 5.1 | Samsung Internet Android ? |
onrejectionhandled | Chrome Full support 49 | Edge ? | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Edge Mobile ? | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | Samsung Internet Android ? |
onstorage | Chrome ? | Edge Full support Yes | Firefox Full support 45 | IE ? | Opera ? | Safari ? | WebView Android No support No | Chrome Android No support No | Edge Mobile Full support Yes | Firefox Android Full support 45 | Opera Android ? | Safari iOS ? | Samsung Internet Android ? |
onunhandledrejection | Chrome Full support 49 | Edge Full support Yes | Firefox
No support
No
| IE No support No | Opera No support No | Safari No support No | WebView Android No support No | Chrome Android No support No | Edge Mobile Full support Yes | Firefox Android
No support
No
| Opera Android No support No | Safari iOS No support No | 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 | Edge Mobile 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.
See also
Document Tags and Contributors
Tags:
Contributors to this page:
mdnwebdocs-bot,
mfluehr,
sideshowbarker,
fscholz,
chrisdavidmills,
jpmedley,
teoli,
Ehsan
Last updated by:
mdnwebdocs-bot,