The onsuspend attribute is an event-handler attribute for <audio> and <video>. It runs JavaScript when the suspend event fires — the user agent is intentionally not fetching media data, and networkState is NETWORK_IDLE.
That can mean there is no more data to load, or loading is unnecessary for now (for example the browser only buffers a few minutes ahead). The event is not cancelable and does not bubble. Related: onstalled, onwaiting, preload, and oncanplay.
Baseline · Widely available.
Not deprecated and not experimental. The suspend event is stable across modern browsers since about July 2015.
Prefer addEventListener in apps.
Inline onsuspend is fine for learning. Production code usually uses media.addEventListener("suspend", handler). Do not confuse this with onpause (playback paused).
Syntax
HTML Syntax
syntax.html
<video|audio onsuspend="script">
script is JavaScript that runs when suspend fires. Equivalent JS: media.onsuspend = handler or media.addEventListener("suspend", handler).
Values
Attribute Values
The attribute value is always a script. Common patterns:
stalled — fetch attempted but data is not arriving.
Local short clips often show suspend and rarely stalled — that’s normal.
Edge Cases & Pitfalls
Most confusion is treating suspend like “playback paused” or like a network error.
vs pause
Not the same as pause
onpause means playback stopped. suspend means download is idle — the video may still be playing from the buffer.
intentional
Intentional idle, not failure
Browsers may buffer only part of a long file, then suspend until more is needed. That is expected, not an error.
stalled
Do not confuse with stalled
stalled is “trying to get data and not getting it.” suspend is “not fetching on purpose.”
bubble
Does not bubble
Listen on the audio/video element itself. Parent listeners will not see a bubbling suspend.
property
.onsuspend = replaces listeners
Assigning the IDL property overwrites a previous assignment. Prefer addEventListener for multiple handlers.
Compatibility
Browser Support
onsuspend is an HTML event-handler attribute for media elements in the browser. It is not a Node.js, Deno, or Bun API.
✓ Baseline · Widely available
onsuspend
Widely available since about July 2015. Chrome, Firefox, Safari, Edge, and Opera support the suspend event on audio and video.
97%Global support (approx.)
Google Chrome3+
Full support
Mozilla Firefox3.5+
Full support
Apple Safari3.1+
Full support
Microsoft Edge12+
Full support
Opera10.5+
Full support
Samsung InternetModern · Full
Full support
Internet Explorer9+
Supported
onsuspendWidely supported
Bottom line: Safe to use for media network UI. Prefer addEventListener in production, and pair with waiting/stalled when you need buffering or error-style feedback.
Remember
Key Takeaways
Role: run script when media data fetch is intentionally idle.
State:networkState is NETWORK_IDLE.
Not pause: playback can continue while download is suspended.
Contrast:waiting / stalled for need-data or failed fetch.
One line:onsuspend means “the browser stopped downloading media on purpose” — idle network, not the same as pausing playback.
Frequently Asked Questions
It is an event-handler attribute on audio or video. The suspend event fires when the browser intentionally is not fetching media data — networkState becomes NETWORK_IDLE. That can mean buffering is done for now, or there is nothing more to load.
The HTML audio and video elements. Put the handler on the media element itself.
No. pause means playback stopped (paused is true). suspend means the user agent stopped downloading media data on purpose — playback may still be playing from the buffer.
stalled means the browser is trying to fetch data but is not receiving it. waiting means playback stopped temporarily for more data. suspend means the browser chose not to fetch more right now (idle).
Both work. For learning, onsuspend in HTML is fine. In production code, prefer media.addEventListener("suspend", handler).
No. The suspend event and onsuspend handler are standard HTML media features and Baseline widely available since about July 2015.