---
title: WindowEventHandlers
slug: Web/API/WindowEventHandlers
tags:
- API
- HTML-DOM
- Interface
- Mixin
- Reference
- WindowEventHandlers
translation_of: Web/API/WindowEventHandlers
---
{{APIRef("HTML DOM")}}
The WindowEventHandlers
mixin describes the event handlers common to several interfaces like {{domxref("Window")}}, or {{domxref("HTMLBodyElement")}} and {{domxref("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 {{domxref("WindowEventHandlers")}}, and implemented by {{domxref("Window")}}, and {{domxref("WorkerGlobalScope")}} for Web Workers.
- {{domxref("WindowEventHandlers.onafterprint")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("afterprint")}} event is raised.
- {{domxref("WindowEventHandlers.onbeforeprint")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeprint")}} event is raised.
- {{domxref("WindowEventHandlers.onbeforeunload")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("beforeunload")}} event is raised.
- {{domxref("WindowEventHandlers.onhashchange")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("hashchange")}} event is raised.
- {{domxref("WindowEventHandlers.onlanguagechange")}} {{experimental_inline}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("languagechange")}} event is raised.
- {{domxref("WindowEventHandlers.onmessage")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("message")}} event is raised.
- {{domxref("WindowEventHandlers.onmessageerror")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("MessageError")}} event is raised.
- {{domxref("WindowEventHandlers.onoffline")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("offline")}} event is raised.
- {{domxref("WindowEventHandlers.ononline")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("online")}} event is raised.
- {{domxref("WindowEventHandlers.onpagehide")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pagehide")}} event is raised.
- {{domxref("WindowEventHandlers.onpageshow")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("pageshow")}} event is raised.
- {{domxref("WindowEventHandlers.onpopstate")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("popstate")}} event is raised.
- {{domxref("WindowEventHandlers.onstorage")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("storage")}} event is raised.
- {{domxref("WindowEventHandlers.onunhandledrejection")}} {{experimental_inline}}
- An event handler for unhandled {{jsxref("Promise")}} rejection events.
- {{domxref("WindowEventHandlers.onunload")}}
- Is an {{domxref("EventHandler")}} representing the code to be called when the {{event("unload")}} event is raised.
Methods
This interface defines no method.
Specifications
Specification |
Status |
Comment |
{{SpecName('HTML WHATWG', '#windoweventhandlers', 'WindowEventHandlers')}} |
{{Spec2('HTML WHATWG')}} |
No change since the latest snapshot, {{SpecName("HTML5.1")}}. |
{{SpecName('HTML5.1', '#windoweventhandlers', 'WindowEventHandlers')}} |
{{Spec2('HTML5.1')}} |
Snapshot of {{SpecName("HTML WHATWG")}}. Added onlanguage since the {{SpecName("HTML5 W3C")}} snapshot. |
{{SpecName("HTML5 W3C", "#windoweventhandlers", "WindowEventHandlers")}} |
{{Spec2('HTML5 W3C')}} |
Snapshot of {{SpecName("HTML WHATWG")}}. Creation of WindowEventHandlers (properties where on the target before it). |
Browser compatibility
{{Compat("api.WindowEventHandlers")}}
See also
- {{domxref("Window")}} and {{domxref("WorkerGlobalScope")}}