Reputation: 437
I have been able to successfully preload image gallery before page loads but was wondering how I could do the same for custom cursor.cur files as it doesn't work using the image method below as it cant understand .cur extension?
// Image Preloader
var pictures [
"a.jpg",
..
"z.jpg"
];
for (var i=0;i < pictures.length; i++){
var img = new Image()
img.src = pictures[i];
img.onload = function(){
updateProgress();
}
}
Upvotes: 5
Views: 827
Reputation: 38318
Load the ico file using an AJAX .get()
and ignore the response. The response should be cached in the browser. Something like:
$.get('/favicon.ico', function() {
alert('Loading of ICO file completed!');
// Do other processing here
});
Upvotes: 4