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.


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');


Specification Status Comment
HTML Living Standard
The definition of 'onloadstart' in that specification.
Living Standard Initial definition

Browser compatibility

BCD tables only load in the browser