WindowEventHandlers

WindowEventHandlers mixin describes the event handlers common to several interfaces like Window, or HTMLBodyElement (en-US) and  HTMLFrameSetElement (en-US). Each of these interfaces can implement additional specific event handlers.

WindowEventHandlers is a not an interface and no object of this type can be created.

屬性

The events properties, of the form onXYZ, are defined on the WindowEventHandlers, and implemented by Window, and WorkerGlobalScope (en-US) for Web Workers.

WindowEventHandlers.onafterprint (en-US)
Is an EventHandler (en-US) representing the code to be called when the afterprint (en-US) event is raised.
WindowEventHandlers.onbeforeprint (en-US)
Is an EventHandler (en-US) representing the code to be called when the beforeprint (en-US) event is raised.
WindowEventHandlers.onbeforeunload
Is an EventHandler (en-US) representing the code to be called when the beforeunload (en-US) event is raised.
WindowEventHandlers.onhashchange (en-US)
Is an EventHandler (en-US) representing the code to be called when the hashchange (en-US) event is raised.
WindowEventHandlers.onlanguagechange (en-US) This is an experimental API that should not be used in production code.
Is an EventHandler (en-US) representing the code to be called when the languagechange (en-US) event is raised.
WindowEventHandlers.onmessage (en-US)
Is an EventHandler (en-US) representing the code to be called when the message event is raised.
WindowEventHandlers.onoffline
Is an EventHandler (en-US) representing the code to be called when the offline (en-US) event is raised.
WindowEventHandlers.ononline
Is an EventHandler (en-US) representing the code to be called when the online (en-US) event is raised.
WindowEventHandlers.onpagehide
Is an EventHandler (en-US) representing the code to be called when the pagehide (en-US) event is raised.
WindowEventHandlers.onpageshow
Is an EventHandler (en-US) representing the code to be called when the pageshow (en-US) event is raised.
WindowEventHandlers.onpopstate
Is an EventHandler (en-US) representing the code to be called when the popstate (en-US) event is raised.
WindowEventHandlers.onstorage (en-US)
Is an EventHandler (en-US) representing the code to be called when the storage (en-US) event is raised.
WindowEventHandlers.onunhandledrejection (en-US) This is an experimental API that should not be used in production code.
An event handler for unhandled Promise rejection events.
WindowEventHandlers.onunload (en-US)
Is an EventHandler (en-US) representing the code to be called when the unload (en-US) event is raised.

方法

This interface defines no method.

規範

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).

瀏覽器相容性

We're converting our compatibility data into a machine-readable JSON format. This compatibility table still uses the old format, because we haven't yet converted the data it contains. Find out how you can help! (en-US)

Feature Firefox (Gecko) Chrome Internet Explorer Opera Safari
Basic support (Yes) (Yes) ? ? ?
onhashchange 3.6 (1.9.2) ? ? ? ?
onlanguage This is an experimental API that should not be used in production code. 32 (32) ? ? ? ?
onstorage 45 (45) ? ? ? ?
Feature Firefox Mobile (Gecko) Android IE Mobile Opera Mobile Safari Mobile
Basic support (Yes) ? ? ? ?
onhashchange 1.0 (1.9.2) ? ? ? ?
onlanguage This is an experimental API that should not be used in production code. 32.0 (32) ? ? ? ?
onstorage 45 (45) ? ? ? ?

參見