I want to check the image width while its loading:
<img src="http://upload.wikimedia.org/wikipedia/commons/3/34/Regensburg_Uferpanorama_08_2006.jpg" id="img" alt="" />
<pre id="pre "></pre>
<script>
var i = 0;
var img = document.getElementById("img");
var pre = document.getElementById("pre");
function checkWidth() {
i++;
pre.innerHTML += "width:" + img.width + ";height:" + img.height + "\n";
if (i < 20) {
setTimeout(function() {
checkWidth();
}, 100);
}
}
checkWidth();
</script>
Now I've tested several browsers and all return 0x0 until the image header (not the complete image) is loaded. After that they return the correct dimensions (e.g. 1920x1080).
But Internet Explorer 11 (I was only able to test this browser version) returns 28x30 pixel for every image (indepentent of aspect ratio), until the header is loaded.
Why does IE11 return this dimensions? Is this the usual behaviour in all IE versions?