dom / latest / globaleventhandlers / onloadstart.html /

GlobalEventHandlers.onloadstart

The onloadstart property of the GlobalEventHandlers mixin 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.)

Syntax

img.onloadstart = funcRef;

Value

funcRef is the handler function to be called when the resource's loadstart event fires.

Examples

HTML content

<img src="myImage.jpg">

JavaScript content

// 'loadstart' fires first, then 'load', then 'loadend'

image.addEventListener('load', function(e) {
  console.log('Image loaded');
});

image.addEventListener('loadstart', function(e) {
  console.log('Image load started');
});

image.addEventListener('loadend', function(e) {
  console.log('Image load finished');
});

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
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.

© 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/onloadstart