Let’s say some image appears on an html page, and so is ‘loaded’ by the browser for display…
<div><img src=somefile.jpg” </img></div>
And then on the same page ,the same image src is ‘loaded’ again, maybe this time in a javascript chain of calls, triggered by the page body’s onload event.
.
[code=html]
<script>
function getImg() {
var img = new Image();
img.onload = function() {return img;}
img.src=’somefile.jpg’; // same file already on the page
}
</script>
<body onload=”getImg()” <body>
Will the second ‘load’ take as much time and memory as the first load of the page, or will it more likely be pulled from browser cache, and take minimal resources.
The background is, i need the original pixel width and height of certain images for subsequent layout and style calculations. Up till now I’ve been doing this server side with PHP, but I think a javascript solution might be better. And modern browsers *DO