I've been working with the history api while I loading pages asynchronously via javascript/ jquery. I wondering how it's possible to tell the browser, that the site is loading, so that the browser can show a loading picture (like the spinning wheel in firefox).
Edit:
To be more specific:
If I load a page on my website, the url changes, the new content is shown, but Firefox don't show the spinning wheel as a signal, that the page is loading.
If I open a picture from the timeline in Facebook, the image is loading, the url changes and Firefox shows the spinning wheel to show, that the image is loading in the background.
I want that spinning wheel too!
I found the answer in these question:
How to have AJAX trigger the browser's loading
var i = $('<iframe>');
console.log(i);
i.appendTo('body');
function start() {
i[0].contentDocument.open();
setTimeout(function() {
stop();
}, 1000);
}
function stop() {
i[0].contentDocument.close();
setTimeout(function() {
start();
}, 1000);
}
start();
Source: jsFiddle
The script creates an iframe, which is triggerd by the ajax.start & ajax.stop-event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With