Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
<!DOCTYPE html>
<head lang="en">
<meta charset="UTF-8">
var onreadys = function(){
if( (/^loaded|^i|^c/).test(document.readyState) ){
console.log('found images: '+ document.getElementsByTagName('img').length);
document.addEventListener('readystatechange', onreadys, false);
} else if(document.attachEvent) {
document.attachEvent('onreadystatechange', onreadys);
<script src="//"></script>
<p>Printed by IE8/IE9:</p>
LOG: interactive
LOG: [object HTMLBodyElement]
LOG: found images: 0
LOG: complete
LOG: [object HTMLBodyElement]
LOG: found images: 3
<img />
<img />
<img />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.