The onloadstart property of the GlobalEventHandlers mixin is an EventHandler representing the code to be called when the loadstart event is raised (when progress has begun on the loading of a resource.)
img.onloadstart = funcRef;
funcRef is the handler function to be called when the resource's loadstart event fires.
<img src="myImage.jpg">
// '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');
}); | Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of 'onloadstart' in that specification. | Living Standard | Initial definition |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | Yes
|
12 | 52 | Yes | Yes
|
Yes
|
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | Yes
|
Yes
|
12 | 52 | Yes
|
Yes
|
Yes
|
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onloadstart