GlobalEventHandlers

The GlobalEventHandlers mixin describes the event handlers common to several interfaces like HTMLElement, Document, or Window. Each of these interfaces can, of course, add more event handlers in addition to the ones listed below.

Note: GlobalEventHandlers is a mixin and not an interface; you can't actually create an object of type GlobalEventHandlers.

Properties

This interface doesn't include any properties except for the event handlers listed below.

Event handlers

These event handlers are defined on the GlobalEventHandlers mixin, and implemented by HTMLElement, Document, Window, as well as by WorkerGlobalScope for Web Workers.

GlobalEventHandlers.onabort

Is an event handler representing the code to be called when the abort event is raised.

GlobalEventHandlers.onanimationcancel

An event handler called when an animationcancel event is sent, indicating that a running CSS animation has been canceled.

GlobalEventHandlers.onanimationend

An event handler called when an animationend event is sent, indicating that a CSS animation has stopped playing.

GlobalEventHandlers.onanimationiteration

An event handler called when an animationiteration event has been sent, indicating that a CSS animation has begun playing a new iteration of the animation sequence.

GlobalEventHandlers.onanimationstart

An event handler called when an animationstart event is sent, indicating that a CSS animation has started playing.

GlobalEventHandlers.onauxclick

An event handler called when an auxclick event is sent, indicating that a non-primary button has been pressed on an input device (e.g. a middle mouse button).

GlobalEventHandlers.onblur

Is an event handler representing the code to be called when the blur event is raised.

GlobalEventHandlers.onerror

Is an event handler representing the code to be called when the error event is raised.

GlobalEventHandlers.onfocus

Is an event handler representing the code to be called when the focus event is raised.

GlobalEventHandlers.oncancel

Is an event handler representing the code to be called when the cancel event is raised.

GlobalEventHandlers.oncanplay

Is an event handler representing the code to be called when the canplay event is raised.

GlobalEventHandlers.oncanplaythrough

Is an event handler representing the code to be called when the canplaythrough event is raised.

GlobalEventHandlers.onchange

Is an event handler representing the code to be called when the change event is raised.

GlobalEventHandlers.onclick

Is an event handler representing the code to be called when the click event is raised.

GlobalEventHandlers.onclose

Is an event handler representing the code to be called when the close event is raised.

GlobalEventHandlers.oncontextmenu

Is an event handler representing the code to be called when the contextmenu event is raised.

GlobalEventHandlers.oncuechange

Is an event handler representing the code to be called when the cuechange event is raised.

GlobalEventHandlers.ondblclick

Is an event handler representing the code to be called when the dblclick event is raised.

GlobalEventHandlers.ondrag

Is an event handler representing the code to be called when the drag event is raised.

GlobalEventHandlers.ondragend

Is an event handler representing the code to be called when the dragend event is raised.

GlobalEventHandlers.ondragenter

Is an event handler representing the code to be called when the dragenter event is raised.

GlobalEventHandlers.ondragleave

Is an event handler representing the code to be called when the dragleave event is raised.

GlobalEventHandlers.ondragover

Is an event handler representing the code to be called when the dragover event is raised.

GlobalEventHandlers.ondragstart

Is an event handler representing the code to be called when the dragstart event is raised.

GlobalEventHandlers.ondrop

Is an event handler representing the code to be called when the drop event is raised.

GlobalEventHandlers.ondurationchange

Is an event handler representing the code to be called when the durationchange event is raised.

GlobalEventHandlers.onemptied

Is an event handler representing the code to be called when the emptied event is raised.

GlobalEventHandlers.onended

Is an event handler representing the code to be called when the ended event is raised.

GlobalEventHandlers.onformdata

Is an event handler for processing formdata events, fired after the entry list representing the form's data is constructed.

GlobalEventHandlers.ongotpointercapture

Is an event handler representing the code to be called when the gotpointercapture event type is raised.

GlobalEventHandlers.oninput

Is an event handler representing the code to be called when the input event is raised.

GlobalEventHandlers.oninvalid

Is an event handler representing the code to be called when the invalid event is raised.

GlobalEventHandlers.onkeydown

Is an event handler representing the code to be called when the keydown event is raised.

GlobalEventHandlers.onkeypress

Is an event handler representing the code to be called when the keypress event is raised.

GlobalEventHandlers.onkeyup

Is an event handler representing the code to be called when the keyup event is raised.

GlobalEventHandlers.onload

Is an event handler representing the code to be called when the load event is raised.

GlobalEventHandlers.onloadeddata

Is an event handler representing the code to be called when the loadeddata event is raised.

GlobalEventHandlers.onloadedmetadata

Is an event handler representing the code to be called when the loadedmetadata event is raised.

GlobalEventHandlers.onloadend

Is an event handler representing the code to be called when the loadend event is raised (when progress has stopped on the loading of a resource.)

GlobalEventHandlers.onloadstart

Is an event handler representing the code to be called when the loadstart event is raised (when progress has begun on the loading of a resource.)

GlobalEventHandlers.onlostpointercapture

Is an event handler representing the code to be called when the lostpointercapture event type is raised.

GlobalEventHandlers.onmousedown

Is an event handler representing the code to be called when the mousedown event is raised.

GlobalEventHandlers.onmouseenter

Is an event handler representing the code to be called when the mouseenter event is raised.

GlobalEventHandlers.onmouseleave

Is an event handler representing the code to be called when the mouseleave event is raised.

GlobalEventHandlers.onmousemove

Is an event handler representing the code to be called when the mousemove event is raised.

GlobalEventHandlers.onmouseout

Is an event handler representing the code to be called when the mouseout event is raised.

GlobalEventHandlers.onmouseover

Is an event handler representing the code to be called when the mouseover event is raised.

GlobalEventHandlers.onmouseup

Is an event handler representing the code to be called when the mouseup event is raised.

GlobalEventHandlers.onmousewheel

Is an event handler representing the code to be called when the mousewheel event is raised. Deprecated. Use onwheel instead.

GlobalEventHandlers.onwheel

Is an event handler representing the code to be called when the wheel event is raised.

GlobalEventHandlers.onpause

Is an event handler representing the code to be called when the pause event is raised.

GlobalEventHandlers.onplay

Is an event handler representing the code to be called when the play event is raised.

GlobalEventHandlers.onplaying

Is an event handler representing the code to be called when the playing event is raised.

GlobalEventHandlers.onpointerdown

Is an event handler representing the code to be called when the pointerdown event is raised.

GlobalEventHandlers.onpointermove

Is an event handler representing the code to be called when the pointermove event is raised.

GlobalEventHandlers.onpointerup

Is an event handler representing the code to be called when the pointerup event is raised.

GlobalEventHandlers.onpointercancel

Is an event handler representing the code to be called when the pointercancel event is raised.

GlobalEventHandlers.onpointerover

Is an event handler representing the code to be called when the pointerover event is raised.

GlobalEventHandlers.onpointerout

Is an event handler representing the code to be called when the pointerout event is raised.

GlobalEventHandlers.onpointerenter

Is an event handler representing the code to be called when the pointerenter event is raised.

GlobalEventHandlers.onpointerleave

Is an event handler representing the code to be called when the pointerleave event is raised.

GlobalEventHandlers.onpointerlockchange

Is an event handler representing the code to be called when the pointerlockchange event is raised.

GlobalEventHandlers.onpointerlockerror

Is an event handler representing the code to be called when the pointerlockerror event is raised.

GlobalEventHandlers.onprogress

Is an event handler representing the code to be called when the progress event is raised.

GlobalEventHandlers.onratechange

Is an event handler representing the code to be called when the ratechange event is raised.

GlobalEventHandlers.onreset

Is an event handler representing the code to be called when the reset event is raised.

GlobalEventHandlers.onresize

Is an event handler representing the code to be called when the resize event is raised.

GlobalEventHandlers.onscroll

Is an event handler representing the code to be called when the scroll event is raised.

GlobalEventHandlers.onsecuritypolicyviolation

Is an event handler representing the code to be called when the securitypolicyviolation event is raised after a Content Security Policy violation.

GlobalEventHandlers.onseeked

Is an event handler representing the code to be called when the seeked event is raised.

GlobalEventHandlers.onseeking

Is an event handler representing the code to be called when the seeking event is raised.

GlobalEventHandlers.onselect

Is an event handler representing the code to be called when the select event is raised.

GlobalEventHandlers.onselectstart

Is an event handler representing the code to be called when the selectionchange event is raised, i.e. when the user starts to make a new text selection on a web page.

GlobalEventHandlers.onselectionchange

Is an event handler representing the code to be called when the selectionchange event is raised, i.e. when the text selected on a web page changes.

GlobalEventHandlers.onshow

Is an event handler representing the code to be called when the show event is raised.

GlobalEventHandlers.onslotchange

Is an event handler representing the code to be called when the slotchange event is raised.

GlobalEventHandlers.onstalled

Is an event handler representing the code to be called when the stalled event is raised.

GlobalEventHandlers.onsubmit

Is an event handler representing the code to be called when the submit event is raised.

GlobalEventHandlers.onsuspend

Is an event handler representing the code to be called when the suspend event is raised.

GlobalEventHandlers.ontimeupdate

Is an event handler representing the code to be called when the timeupdate event is raised.

GlobalEventHandlers.onvolumechange

Is an event handler representing the code to be called when the volumechange event is raised.

GlobalEventHandlers.ontouchcancel

Is an event handler representing the code to be called when the touchcancel event is raised.

GlobalEventHandlers.ontouchend

Is an event handler representing the code to be called when the touchend event is raised.

GlobalEventHandlers.ontouchmove

Is an event handler representing the code to be called when the touchmove event is raised.

GlobalEventHandlers.ontouchstart

Is an event handler representing the code to be called when the touchstart event is raised.

GlobalEventHandlers.ontransitioncancel

An event handler called when a transitioncancel event is sent, indicating that a CSS transition has been cancelled.

GlobalEventHandlers.ontransitionend

An event handler called when a transitionend event is sent, indicating that a CSS transition has finished playing.

GlobalEventHandlers.ontransitionrun

An event handler called when a transitionrun event is sent, indicating that a CSS transition is running, though not nessarilty started.

GlobalEventHandlers.ontransitionstart

An event handler called when a transitionstart event is sent, indicating that a CSS transition has started transitioning.

GlobalEventHandlers.onwaiting

Is an event handler representing the code to be called when the waiting event is raised.

Methods

This interface defines no methods.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
GlobalEventHandlers
1
12
1
4
Yes
1
1
18
4
Yes
1
1.0
onabort
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
onanimationcancel
No
No
54
No
?
13.1
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
No
No
54
?
13.4
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
No
onanimationend
79
81
43-79
Only supported on the Window interface.
18
81
51
No
66
68
30-66
Only supported on the Window interface.
9
79
81
43-79
Only supported on the Window interface.
79
81
43-79
Only supported on the Window interface.
51
57
59
30-57
Only supported on the Window interface.
9
12.0
13.0
4.0-12.0
Only supported on the Window interface.
onanimationiteration
79
81
43-79
Only supported on the Window interface.
18
81
51
No
66
68
30-66
Only supported on the Window interface.
9
79
81
43-79
Only supported on the Window interface.
79
81
43-79
Only supported on the Window interface.
51
57
59
30-57
Only supported on the Window interface.
9
12.0
13.0
4.0-12.0
Only supported on the Window interface.
onanimationstart
79
81
43-79
Only supported on the Window interface.
18
81
51
No
66
68
30-66
Only supported on the Window interface.
9
79
81
43-79
Only supported on the Window interface.
79
81
43-79
Only supported on the Window interface.
51
57
59
30-57
Only supported on the Window interface.
9
12.0
13.0
4.0-12.0
Only supported on the Window interface.
onauxclick
55
79
53
No
42
No
55
55
53
42
No
6.0
onblur
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
oncancel
32
79
No
No
19
No
4.4.3
32
No
19
No
2.0
oncanplay
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
oncanplaythrough
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onchange
1
12
1
9
9
3
1
18
4
10.1
1
1.0
onclick
1
12
1
4
9
3
1
18
4
10.1
1
1.0
onclose
32
79
53
No
19
No
4.4.3
32
53
19
No
2.0
oncontextmenu
1
12
9
5
≤12.1
4
≤37
18
9
≤12.1
3.2
1.0
oncuechange
32
18
68
Added for the <track> element (HTMLTrackElement) in Firefox 68.
31
Added for the TextTrack interface in Firefox 31.
No
19
≤12.1-15
10.1
4.4.3
32
68
Added for the <track> element (HTMLTrackElement) in Firefox 68.
31
Added for the TextTrack interface in Firefox 31.
19
≤12.1-14
10.3
2.0
ondblclick
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
ondrag
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondragend
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondragenter
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondragexit
No
12-79
3.5
10
12
3.1
No
No
No
No
No
No
ondragleave
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondragover
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondragstart
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondrop
1
12
9
9
12
3.1
1
18
9
12
2
1.0
ondurationchange
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onemptied
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onended
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onerror
10
12
1
9
11.6
6
≤37
18
4
12
6
1.0
onfocus
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
onformdata
77
79
72
No
64
No
77
77
79
55
No
12.0
ongotpointercapture
57
17
59
No
44
13
57
57
79
43
13
7.0
oninput
1
12
9
9
10
4
≤37
18
9
10.1
3.2
1.0
oninvalid
4
13
9
No
≤12.1
5
≤37
18
9
≤12.1
4
1.0
onkeydown
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onkeypress
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onkeyup
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onload
1
12
1
9
9
3
1
18
4
10.1
1
1.0
onloadeddata
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onloadedmetadata
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onloadend
No
No
52
No
No
No
No
No
52
No
No
No
onloadstart
32
The loadstart event is not fired on <img> elements.
12
9
9
19
The loadstart event is not fired on <img> elements.
≤12.1-15
9
The loadstart event is not fired on <img> elements.
4.4.3
The loadstart event is not fired on <img> elements.
32
The loadstart event is not fired on <img> elements.
9
19
The loadstart event is not fired on <img> elements.
≤12.1-14
9
The loadstart event is not fired on <img> elements.
2.0
The loadstart event is not fired on <img> elements.
onlostpointercapture
57
17
59
No
44
13
57
57
79
43
13
7.0
onmousedown
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onmouseenter
30
12
10
5.5
17
7
4.4
30
10
18
7
2.0
onmouseleave
30
12
10
5.5
17
7
4.4
30
10
18
7
2.0
onmousemove
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onmouseout
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onmouseover
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onmouseup
1
12
9
4
≤12.1
1
1
18
9
≤12.1
1
1.0
onmousewheel
1
12
No
9
≤15
3
1
18
No
≤14
1
1.0
onpause
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onplay
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onplaying
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onpointercancel
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerdown
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerenter
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerleave
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointermove
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerout
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerover
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onpointerrawupdate
77
79
No
No
64
No
77
77
No
55
No
12.0
onpointerup
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0
onprogress
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onratechange
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onreset
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
onresize
34
79
12-79
In EdgeHTML versions of Edge, this handler was only supported on the Window API.
38
4
In Internet Explorer, this handler was only supported on the Window API.
21
10.1
37
34
38
21
10.3
2.0
onscroll
1
12
9
9
≤12.1
1.3
1
18
9
≤12.1
1
1.0
onsecuritypolicyviolation
No
No
93
No
No
preview
No
No
93
No
No
No
onseeked
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onseeking
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onselect
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
onselectionchange
11
12
52
5.5
15
5.1
≤37
18
52
14
5
1.0
onselectstart
1
12
52
4
15
1.3
1
18
52
14
1
The selectstart event never fires and never invokes this handler.
1.0
onshow
No
No
85
8-85
No
?
No
No
No
85
8-85
?
No
No
onslotchange
No
No
93
No
No
preview
No
No
93
No
No
No
onstalled
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onsubmit
1
12
9
9
≤12.1
1
1
18
9
≤12.1
1
1.0
onsuspend
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
ontimeupdate
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
ontouchcancel
No
No
No
No
No
No
≤37
18
Yes
≤14
≤3
1.0
ontouchend
No
No
No
No
No
No
≤37
18
Yes
≤14
≤3
1.0
ontouchmove
No
No
No
No
No
No
≤37
18
Yes
≤14
≤3
1.0
ontouchstart
No
No
No
No
No
No
≤37
18
Yes
≤14
≤3
1.0
ontransitioncancel
87
87
53
No
73
13.1
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
87
87
53
No
13.4
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
14.0
ontransitionend
79
81
26-79
Only supported on the Window interface.
18
81
51
No
The ontransitionend attribute is not supported in IE. To listen to this event, use document.addEventListener('transitionend', function() {});.
66
68
15-66
Only supported on the Window interface.
11
79
81
≤37-79
Only supported on the Window interface.
79
81
26-79
Only supported on the Window interface.
51
57
59
14-57
Only supported on the Window interface.
11
11.0
13.0
1.5-11.0
Only supported on the Window interface.
ontransitionrun
87
87
53
No
The ontransitionrun attribute is not supported in IE. To listen to this event, use document.addEventListener('transitionrun', function() {});.
73
13.1
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
87
87
53
No
13.4
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
14.0
ontransitionstart
87
87
53
No
The ontransitionstart attribute is not supported in IE. To listen to this event, use document.addEventListener('transitionstart', function() {});.
73
13.1
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
87
87
53
No
13.4
12
The event handler is exposed but will not actually be called unless both the "Web Animations" and "CSS Animations via Web Animations" preferences are enabled.
14.0
onvolumechange
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onwaiting
32
12
9
9
19
≤12.1-15
9
4.4.3
32
9
19
≤12.1-14
9
2.0
onwheel
31
12
17
No
18
7
4.4.3
31
17
18
7
2.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers