--- title: GlobalEventHandlers.onloadstart slug: Web/API/GlobalEventHandlers/onloadstart translation_of: Web/API/GlobalEventHandlers/onloadstart ---
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.)
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 |
---|---|---|
{{SpecName("HTML WHATWG", "webappapis.html#handler-onloadstart", "onloadstart")}} | {{Spec2("HTML WHATWG")}} | Initial definition |
{{Compat("api.GlobalEventHandlers.onloadstart")}}