I am trying to show a loading spinner while safari and safari iOS is loading the next page.
I've managed to achieve this in Chrome + Firefox. I'm not fussed if doesn't work in IE.
So the script below works fine in Chrome + Firefox, but doesn't work in Safari or Safari iOS.
I'm guess the behaviour 'window.location.href' is different, but is there a work around to fix this?
// stop home screen webapp from exiting the webwapp into mobile safari
$("a").not('[href="#"]').each(function() {
// bind click action
$(this).on("click", function(e) {
// reveal loader spinner
$('.loading').addClass('show');
// window href simulate click within webapp
window.location.href = $(this).attr('href');
// prevent default click
e.preventDefault();
});
});