Menu
What I am currently trying to achieve is to download a dynamically created image in the background, then assigning it to an elements backgroundImage style after it has been successfully completed, preventing a whitescreen.
For example:
[CODE]var $image = new Image();
$image.onload = function()
{
document.getElementById(“element”).style.backgroundImage = ‘url(‘ + this.src + ‘)’;
};
$image.src = “/images/background.png”;
This works as expected in FireFox, but in IE and Chrome the background image is requested once again after it has been assigned to the element, ignoring the image in cache.
Has anyone ever done this before?