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.onstorage
- Is an
EventHandler
representing the code to be called when thestorage
event is raised. WindowEventHandlers.onunhandledrejection
- An event handler for unhandled
Promise
rejection events. 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 '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
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | ? | (Yes) | ? |
onbeforeunload |
(Yes) | ? | ? | ? | ? |
onhashchange |
(Yes) | 3.6 (1.9.2) | ? | (Yes) | ? |
onlanguage |
(Yes) | 32 (32) | ? | (Yes) | ? |
onlanguagechange |
(Yes) | ? | ? | (Yes) | ? |
onmessage |
(Yes) | ? | ? | (Yes) | ? |
onmessageerror |
60 | ? | ? | 47 | ? |
onoffline |
(Yes) | ? | ? | (Yes) | ? |
ononline |
(Yes) | ? | ? | (Yes) | ? |
onpagehide |
(Yes) | ? | ? | (Yes) | ? |
onpageshow |
(Yes) | ? | ? | (Yes) | ? |
onpopstate |
(Yes) | ? | ? | (Yes) | ? |
onrejectionhandled |
(Yes) | ? | ? | (Yes) | ? |
onstorage |
(Yes) | 45 (45) | ? | (Yes) | ? |
onunhandledrejection |
(Yes) | ? | ? | (Yes) | ? |
onmessageerror |
60 | 57 (57) | No support | 47 | ? |
Feature | Android Webview | Chrome for Android | Firefox Mobile (Gecko) | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | (Yes) | (Yes) | ? |
onbeforeunload |
(Yes) | (Yes) | ? | (Yes) | ? |
onhashchange |
(Yes) | (Yes) | 1.0 (1.9.2) | (Yes) | ? |
onlanguage |
(Yes) | (Yes) | 32.0 (32) | (Yes) | ? |
onlanguagechange |
(Yes) | (Yes) | ? | (Yes) | ? |
onmessage |
(Yes) | (Yes) | ? | (Yes) | ? |
onmessageerror |
60 | 60 | ? | (Yes) | ? |
onoffline |
(Yes) | (Yes) | ? | (Yes) | ? |
ononline |
(Yes) | (Yes) | ? | (Yes) | ? |
onpagehide |
(Yes) | (Yes) | ? | (Yes) | ? |
onpageshow |
(Yes) | (Yes) | ? | (Yes) | ? |
onpopstate |
(Yes) | (Yes) | ? | (Yes) | ? |
onrejectionhandled |
(Yes) | (Yes) | ? | (Yes) | ? |
onstorage |
(Yes) | (Yes) | 45.0 (45) | (Yes) | ? |
onunhandledrejection |
(Yes) | (Yes) | ? | (Yes) | ? |
onunload |
(Yes) | (Yes) | ? | (Yes) | ? |
onmessageerror |
60 | 60 | 57.0 (57) | 47 | ? |