The probable solution is to use iframe
to trigger the loading. But based on previous answer, iframe method cannot work on chrome.
Your need is to show the loading icon on browser, so I think another way is to create fake loading icon
.
You can update the browser icon manually. There are some tutorials about how to update browser icon.
And then, try to make icon animate. Most of browser doesn t support gif
icon, so what you need to do is update icon in every few seconds.
This is demo code:
var favicon_images = [];
for (var i = 1; i <= 12; i++)
favicon_images.push( ./icon/ + i + .png );
var image_counter = 0;
setInterval(function() {
var link = document.querySelector("link[rel*= icon ]") || document.createElement( link );
link.type = image/x-icon ;
link.rel = shortcut icon ;
link.href = favicon_images[image_counter];
document.getElementsByTagName( head )[0].appendChild(link);
if(image_counter == favicon_images.length -1)
image_counter = 0;
else
image_counter++;
}, 150);
I create a quick demo. Demo
With this demo, you can find that the icon animation doesn t run smoothly. That is because everytime we update the icon, browser request the icon again.
So transform the image to base64 format than it works smoothly.
Base64 demo
Now you just need to find the loading icon is the same with Chrome
and other popular browsers, then trigger the fake loading
when you call ajax.
Here I paste some change icon tutorial: