Skip to content

Instantly share code, notes, and snippets.

@aFarkas
Created October 20, 2014 17:56
Show Gist options
  • Save aFarkas/286b2876ba64551b9c3e to your computer and use it in GitHub Desktop.
Save aFarkas/286b2876ba64551b9c3e to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script>
var onreadys = function(){
console.log(document.readyState);
console.log(document.body);
if( (/^loaded|^i|^c/).test(document.readyState) ){
console.log('found images: '+ document.getElementsByTagName('img').length);
}
};
if(document.addEventListener){
document.addEventListener('readystatechange', onreadys, false);
} else if(document.attachEvent) {
document.attachEvent('onreadystatechange', onreadys);
}
</script>
</head>
<body>
<div>
</div>
<script src="//code.jquery.com/jquery-1.11.0.js"></script>
<p>Printed by IE8/IE9:</p>
<pre>
LOG: interactive
LOG: [object HTMLBodyElement]
LOG: found images: 0
LOG: complete
LOG: [object HTMLBodyElement]
LOG: found images: 3
</pre>
<img />
<img />
<img />
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment