Recent Page Changes for Alex Bosworth's Weblog
If you are using <a href='http://swik.net/Ajax'>Ajax</a>, and by Ajax I meant XMLHttpRequest, and you are using it intensively,...
» complete changeIf you are using <a href='http://swik.net/Ajax'>Ajax</a>, and by Ajax I meant XMLHttpRequest, and you are using it intensively, you may have noticed you want to give people an indication that requests are being sent to the server.
The browser does this by making something called the 'throbber' move. This takes various shapes, from stars flying across a giant N, to a windows flag waving, to small dots rotating. In <a href='http://swik.net/FireFox'>FireFox</a>, or other tabbed browsers, the throbber also acts as a helpful indicator on a tab to indicate whether a tab has finished loading.
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 href='http://sandbox.sourcelabs.com/wikiality/throbber'>a demo page on wikiality</a>, so you can see the technique in action and the source code behind it.
<hr>
PS: Btw to all the word police and wordinistas who wrote in to say that wikiality is the exclusive province of Steven Colbert: If Steven Colbert wants me not to use it, he can ask me himself, and if he doesn't come over to my office to demand it back, well then he's a coward and he doesn't deserve it anyways.
