Search code examples
comet

Stop browser throbber spinning for Comet using iframe


When I use comet using iframe push, the browser throbber will keep spinning forever while the data is being pushed through the iframe.

Lightstreamer is also using iframe, but how do they manage to make it stop?

I found a similar post here but it doesn't seem to solve my problem. Any explanation on how lightstreamer works would greatly appreciately. Thank you.


Solution

  • I wrote a post about this at http://www.shanison.com/2010/05/10/stop-the-browser-%E2%80%9Cthrobber-of-doom%E2%80%9D-while-loading-comet-forever-iframe/

    Below are summary solutions for different browsers: 1. Firefox In firefox, before you trigger the call back method to update the content, you have to create a temp iframe and attach to the document body, then removes it. By keep doing this before you trigger the event, the browser throbber goes away. 2. Chrome/Safari For chrome and safari if you just do like above, the forever iframe won’t work at all! There won’t be any data returned from server side. So how do you make comet iframe work in chrome and safari.The hacks lies on server side. There are two conditions that you must fullfill in order to make forever iframe happens in this webkit browsers. Firstly, the server must push some junk data (around 2k) to the browser before you push the real data. So just write out some javascript comments to the browsers first. 3. IE In IE, if you use above iframe method, it works. I have successfully done that. However in order to stop the browser throbber of doom, you have to make use of the special htmlfile object.