Update
The previous solution was incorrect. (Thanks to @donut).
Here is an alternative easy way to do this with jQuery -
$(function() {
$("<img src='img_01.jpg' />").load(function() {
});
});
Javascript
Use image preload in JavaScript -
img1 = new Image();
img1.src = "image.jpg";
// at this line image.jpg has been loaded
After that img1.src = "image.jpg";you can assure that the image is uploaded, and you can write your business logic
JQuery
Here is a simple jQuery plugin for this -
$.fn.preload = function () {
this.each(function () {
$('<img/>')[0].src = this;
});
};
-
var imagesToPreload = ["img01.jpg", "img02.jpg", "img03.jpg"];
imagesToPreload .preload();
a >