Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can we control the "loading" icon in the browser tab?

Tags:

I have a series of AJAX calls via jQuery. When an ajax call is being performed, there is no visual indication. Normally if you click a link or otherwise some non-ajax load the browser displays a little loading icon up in the tab.

Is there any way to tell the browser to display this little icon in the tab? (There are about 30 of these calls so I hope to avoid modifying each one).

like image 835
P.Brian.Mackey Avatar asked Nov 15 '11 15:11

P.Brian.Mackey


2 Answers

No, you can't tell the browser such a thing.

But you can do your own loading indicator. Include a hidden element in your markup, then use the ajaxStart and ajaxStop events to control its visibility:

$("#loading_animation").bind({
    ajaxStart: function() { $(this).show(); },
    ajaxStop: function() { $(this).hide(); }
});

ajaxStart is fired by jQuery when an ajax request is started when none others are running; ajaxStop is fired when an ajax request completes are there are no others running.

like image 173
Royi Namir Avatar answered Oct 29 '22 13:10

Royi Namir


No.

But you can modify the css of the cursor.

body {
   cursor:wait;
}
like image 30
Naftali Avatar answered Oct 29 '22 13:10

Naftali