I'm trying to use a loader with the event window.load
and everything works fine for me. But apparently in chrome, I don't know about other browsers, when the page is loaded from the cache the onload
event is not fired.
Apparently the same thing happens when onload is used with an image. Only with images the solution to this is to set the src attribute after adding the handler to the event.
But window.load
I don't know how to solve that problem.
I leave here the code of the loader that I am using:
window.onload = function(){
if(containerLoader){
containerLoader.fadeOut(200);
}
if(loaderMap){
loaderMap.fadeOut(200);
}
}
As I said it works very well for me a couple of times but if I update several times it starts to load the loader. I am also working with shopify which seems to me to have included methods to cache the page and load faster.