CKTIS / HTML
onloadstart — handling the start of media loading
The onloadstart attribute specifies JavaScript that handles the loadstart event. For audio and video elements, this event signals the start of looking for media data, not completion of the download or readiness to play.
Version: WHATWG HTML Living Standard; index snapshot date recorded separately
Syntax
onloadstart="JavaScript statements"onloadstart is an event handler content attribute for loadstart. Its value is a JavaScript function body, not a resource address. Inside the attribute code, the event parameter provides the event. The HTML index classifies this attribute as available on HTML elements; its presence alone does not mean every element automatically emits loadstart.
For audio and video, the browser fires loadstart when it begins looking for data in the media resource selection algorithm. This does not confirm that data has downloaded, loading has succeeded, or playback is ready. loadedmetadata and loadeddata represent different stages; loadstart must not be confused with load either.
The HTML attribute onloadstart and the JavaScript property with the same name configure the handler. In addEventListener('loadstart', handler), the event name has no on prefix. Content Security Policy can block code placed directly in the attribute.
The example deliberately dispatches a synthetic loadstart, so it needs neither a media file nor a network connection. The paragraph should display loadstart. This checks handler invocation, not actual loading behavior. Index snapshot date: 2026-11-18.
Examples
<!doctype html>
<meta charset="utf-8">
<title>onloadstart</title>
<audio id="media" onloadstart="document.getElementById('result').textContent = event.type"></audio>
<p id="result">waiting</p>
<script>
document.getElementById('media').dispatchEvent(new Event('loadstart'));
</script>Result
loadstart
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.