Reputation: 1343
This question is a little bit tricky as I do not fully know which category / language / technology / area it falls.
Occassionally we're forwarding our user to another a form is submitted and handled. The form submission is done with jQuery Form plugin's .ajaxSubmit()
call, to provide feedback for user and if any error occurs, to give smooth ability to correct the 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 getting forwarded to the next page, the loading.gif animation is stopped. This confuses the user.
I can confirm that this appens at least with Firefox and Chrome. Is there a way to keep loading indicator running while user is navigating to the next page (before the next page is rendered)?
Stopping the animations could be (intentional or unintentional) behavior of the browser application itself and thus completely uncontrollable by the web developer. However, I could not find any material that confirms it, so still looking for some solution - or alternative ways to do the indicator.
Upvotes: 3
Views: 201
Reputation: 1343
Beetroot-Beetroot answered my question in the question comments: you cannot control the browser behavior at this level.
Upvotes: 1