views:

36

answers:

2

I need to have my web page periodically poll the server for new information every 10 seconds. I have a timer (setTimeout) setup to call my AJAX function to get the data. On completion, the AJAX function sets the timer for another 10 seconds.

The problem is that Firefox continuously displays the "Page Loading Indicator" (Throbbing).

How do I periodically poll for new data, but stop the throbbing?

P.S. If I hit the ESC key, the throbbing stops and the timer keeps going, so that is a crude workaround. I need a way to not involve/confuse the user.

+1  A: 

There are a few techniques to "background" loading where you don't display the status bar or cursor changes:

XHR Eval and XHR Injection are the only techniques that do what you want for FF (and all other browsers). You can see the test/example site here: http://stevesouders.com/hpws2/couple-xhr-injection.php

AutoSponge
+1  A: 

You can also look at WebSockets.

It will be faster and there will be no need in timer.

how
Useless until browsers support it. And even when they do 50% of all people would not have those browsers.
diamandiev
I need this to work with Firefox 3.x, unfortunately.
Robert
You can use it in all modern browsers. HTML5 Web Socket implementation powered by Flash - http://github.com/gimite/web-socket-js#readme
how