ClickAider
You are currently browsing the Bogle’s Blog weblog archives for the day Thursday, September 21st, 2006.

Alex Bosworth: Better Ajax progress feedback

Alex Bosworth has a nice trick for making the browser “throbber” move during Ajax requests.  This provides feedback that a request is being sent to the server, and is especially useful on tabbed browsers as a way to indicate when the tab is finished loading.

Check out Ajax: A Throbber For All Seasons:

As a heavy internet user, I have become attuned to the signal that a webpage is still loading, and in an application that uses XMLHttpRequest, it can be confusing as to what is going on.

So I’ve developed a technique to fake the browser throbbing, by launching a dumb parallel request to the XHR request. The parallel request merely creates an iframe to a page that will load for a long time, triggering the throbber. When I want to stop the throbber, I just destroy the iframe.

I’ve rigged up a demo page on wikiality, so you can see the technique in action and the source code behind it.