--- title: GlobalEventHandlers.onloadstart slug: Web/API/GlobalEventHandlers/onloadstart translation_of: Web/API/GlobalEventHandlers/onloadstart ---
{{ApiRef}}

TheĀ onloadstart property of the {{domxref("GlobalEventHandlers")}} mixin is an {{event("Event_handlers", "event handler")}} representing the code to be called when the {{event("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

Specification Status Comment
{{SpecName("HTML WHATWG", "webappapis.html#handler-onloadstart", "onloadstart")}} {{Spec2("HTML WHATWG")}} Initial definition

Browser Compatibility

{{Compat("api.GlobalEventHandlers.onloadstart")}}