Well, this seems pretty simple and works in all except IE when launched for a local page (the local activeX 'protection bar' appears to interfere). However, it will work in Opera 9, FF 1.5.0.5, local and live, and IE 6 run live or after the activeX warning has been cleared for the session. I tested all three browsers with a fresh page load (navigating from Google) after clearing the cache:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
function getDim(id){
var im=document.getElementById(id);
var newIm=new Image();
newIm.src=im.src;
alert('width='+newIm.width+'\nheight='+newIm.height);
}
</script>
</head>
<body onload="getDim('theImg')">
<img id="theImg" src="http://home.comcast.net/~jscheuer1/side/1st.jpg" width="300" height="200">
</body>
</html>
The image is actually 1500x1000 and that gets reported faithfully in all three browsers as mentioned above.
Bookmarks