onpause — media pause event handler
The onpause attribute contains JavaScript that handles the pause event, usually on an audio or video element. It reacts to playback being paused but does not itself pause playback.
CKTIS / Knowledge base
Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.
The onpause attribute contains JavaScript that handles the pause event, usually on an audio or video element. It reacts to playback being paused but does not itself pause playback.
The onplay attribute contains JavaScript executed for the play event, typically on an audio or video element. This event signals leaving the paused state, not a guarantee that sound or video is already playing.
The onplaying attribute contains code that handles the playing event, used by audio and video when playback is ready to start or resume after an interruption. It does not start playback and is not equivalent to onplay.
The onpopstate attribute on body sets the Window object's popstate event handler. It lets a page respond to session history traversal, such as Back and Forward navigation, and read the destination entry's state.
The onprogress attribute contains JavaScript that handles the progress event. For audio and video elements, it concerns media data downloading, not the passage of playback time.
The onratechange attribute specifies JavaScript that handles the ratechange event, fired after a media element's playbackRate or defaultPlaybackRate changes.
The body attribute onrejectionhandled registers a handler for the Window rejectionhandled event: a previously unhandled Promise rejection has subsequently acquired a handler.
The onreset attribute contains JavaScript that handles a form's reset event. The handler runs before default values are restored and can cancel the reset.
The onresize attribute contains JavaScript that handles a resize event. On the body element, it targets Window rather than changes to the size of the body element itself.
The onscroll attribute contains JavaScript executed when a scroll event is received. It lets an element react to scrolling, but does not itself create a scrollable area.
The onscrollend attribute assigns JavaScript code to the scrollend event, which signals that scrolling has finished. Distinguish the attribute name from the event name used with addEventListener().
The onsecuritypolicyviolation attribute specifies JavaScript that handles the securitypolicyviolation event associated with a Content Security Policy (CSP) violation. It does not establish a security policy, and CSP can block its inline code.
The onseeked attribute specifies JavaScript to run for the seeked event. On audio and video elements, this event signals that a seek has completed, not that media playback has ended.
`onseeking` specifies code that handles the `seeking` event. The event signals the start of a seek operation in audio or video, even if the playback position stays the same. It does not signal completion.
The onselect attribute defines JavaScript that runs when a select event occurs, typically when text is selected in an input or textarea control. It does not detect option selection in a select element.
onslotchange specifies a handler for the slotchange event. In Shadow DOM, this event can fire when a slot’s assigned nodes change or when a direct child is added to or removed from a slot with no assigned nodes.
The onstalled attribute specifies code to run for the stalled event, when the browser is trying to fetch media data but data is not arriving. This concerns downloading, not necessarily an interruption of playback.
The onstorage attribute on body sets the Window handler for the storage event. It reacts to changes to shared localStorage or sessionStorage made in another document, rather than in the document performing the write.
The onsubmit attribute specifies JavaScript that handles the submit event. It lets you react to a form submission attempt and cancel the default submission; it does not confirm that data reached the server.
The onsuspend attribute specifies JavaScript to run for the suspend event. For audio and video, this event means the browser is intentionally not fetching data at present, not that playback has been paused.
The ontimeupdate attribute contains JavaScript that handles the timeupdate event, used when an audio or video playback position is updated. It can refresh a time indicator but does not provide precise timing.
The ontoggle attribute contains JavaScript that handles the toggle event after an element's open state changes. Relevant elements include details, dialog, and elements acting as popovers. The attribute does not itself open or close an element.
The onunhandledrejection attribute on body registers a handler for the Window object's unhandledrejection event. It exposes the rejection reason of a promise that still lacks rejection handling when notification occurs.
The body element's onunload attribute sets a handler for the Window object's unload event, not an event handler targeting the element itself. It is neither a reliable place to save data nor a way to prevent leaving a page.