| 1 |
<!doctype html> |
| 2 |
<html class="no-js"> |
| 3 |
<head> |
| 4 |
<meta charset="utf-8"/> |
| 5 |
<title>Test: SCRIPT SRC in bottom</title> |
| 6 |
<link rel="stylesheet" href="style.min.css" /> |
| 7 |
<script> |
| 8 |
// calculate difference between zero and window.onload |
| 9 |
window.onload = function () { |
| 10 |
var stop = new Date(); |
| 11 |
document.getElementById("content").style.display = "block"; |
| 12 |
document.getElementById("ms").innerHTML = (stop - start); |
| 13 |
}; |
| 14 |
</script> |
| 15 |
</head> |
| 16 |
<body> |
| 17 |
<div id="wrap"> |
| 18 |
<div id="nav" class="clear"> |
| 19 |
<a href="script.html">SCRIPT SRC <em>in head</em></a> |
| 20 |
<a href="script-bottom.html">SCRIPT SRC <em>on bottom</em></a> |
| 21 |
<a href="headjs.html">head.js <em>on head</em></a> |
| 22 |
<br /> |
| 23 |
</div> |
| 24 |
<div id="content" style="display: none"> |
| 25 |
<h1>SCRIPT SRC before </body></h1> |
| 26 |
<div id="time"><span id="ms"></span>ms</div> |
| 27 |
<p> |
| 28 |
Press <strong>CTRL+SHIFT+R</strong> or <strong>CTRL+F5</strong> to reload with an <strong>empty cache</strong> = first impression. |
| 29 |
</p> |
| 30 |
<br /> |
| 31 |
<p> |
| 32 |
<strong>View source</strong> to see how scripts are provided. |
| 33 |
</p> |
| 34 |
<p> |
| 35 |
Time is calculated when <code>window.onload</code> fires. |
| 36 |
</p> |
| 37 |
<p> |
| 38 |
Try with different browsers. The time difference varies a lot. |
| 39 |
</p> |
| 40 |
<p class="details"> |
| 41 |
head.js() calls are always separate from the page rendering. Does not matter |
| 42 |
whether you load on HEAD or on bottom. You can also load programmatically on |
| 43 |
demand. |
| 44 |
</p> |
| 45 |
</div> |
| 46 |
<div id="footer"> |
| 47 |
<a href="/site/unit.html">« Back</a> |
| 48 |
| <a href="https://github.com/headjs/headjs/issues">found a bug?</a> |
| 49 |
</div> |
| 50 |
</div> |
| 51 |
<script> |
| 52 |
var start = new Date(); |
| 53 |
</script> |
| 54 |
<script src="http://ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script> |
| 55 |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> |
| 56 |
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script> |
| 57 |
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> |
| 58 |
<script src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script> |
| 59 |
</body> |
| 60 |
</html> |