Is there a way to keep the "Loading ..." animation while the user navigates to another page?
This question is a little tricky as I don't fully know which category / language / technology / area it falls into.
Sometimes we forward our user to another and the form is submitted and processed. The form submission is done using the jQuery Form plugin .ajaxSubmit()
to provide feedback to the user and, if any error occurs, to provide a smooth opportunity to correct errors.
$('#form').submit(function(e) {
e.preventDefault();
var loading = $('<img src="loading.gif" />');
$('#form').append(loading);
$('#form').ajaxSubmit({
dataType: 'json',
success: function(d) {
if (d.errors) {
loading.remove();
// Handle the errors
} else {
// Forward the user to the next address, given by the server
document.location = d.forward_to;
}
}
});
});
While the user is navigating to the next page, the load.gif animation stops. This confuses the user.
I can confirm that this adds at least Firefox and Chrome. Is there a way to keep the loading progress bar while the user navigates to the next page (before the next page is displayed)?
Stopping animations can be a (intentional or unintentional) behavior of the browser application itself and is thus not completely under the control of the web developer. However, I haven't been able to find a single material to support it, so I'm still looking for some solution - or alternative ways to make an indicator.
source to share
Beetroot-Beetroot answered my question in the comments to the question: You cannot control browser behavior at this level.
source to share