blob: 33bfbd734a65bce2fce26ebae3c58c8133553bd9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
---
title: GlobalEventHandlers.onloadstart
slug: Web/API/GlobalEventHandlers/onloadstart
translation_of: Web/API/GlobalEventHandlers/onloadstart
---
<div>{{ApiRef}}</div>
<p>The <strong><code>onloadstart</code></strong> property of the {{domxref("GlobalEventHandlers")}} mixin is an {{domxref("EventHandler")}} representing the code to be called when the {{event("loadstart")}} event is raised (when progress has begun on the loading of a resource.)</p>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><var>img</var>.onloadstart = <var>funcRef</var>;
</pre>
<h3 id="Value">Value</h3>
<p><code>funcRef</code> is the handler function to be called when the resource's <code>loadstart</code> event fires.</p>
<h2 id="Examples">Examples</h2>
<h3 id="HTML_content">HTML content</h3>
<pre class="brush: html"><img src="myImage.jpg"></pre>
<h3 id="JavaScript_content">JavaScript content</h3>
<pre class="brush: js">// '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');
});</pre>
<h2 id="Specifications">Specifications</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName("HTML WHATWG", "webappapis.html#handler-onloadstart", "onloadstart")}}</td>
<td>{{Spec2("HTML WHATWG")}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="Browser_Compatibility">Browser Compatibility</h2>
<div>
<p>{{Compat("api.GlobalEventHandlers.onloadstart")}}</p>
</div>
|