I\'m using jsonp to do cross-domain comet requests, and the \"loading\" status is really annoying.
Is there any way to suppress this with javascript?
For tho
If you begin your first request after the page has finished loading, you should be able to avoid the loading indicator.
$(function () {
setTimeout(function () {
$.jsonp(...)
}, 1000);
});
As far as I know, there is no way to suppress the loading status using Javascript, regardless of why you have it.
However, there is at least one alternative for cross-domain COMET which wouldn't trigger the loading status in the first place. XMLHttpRequest doesn't set the loading status and, according to my tests, the CORS (Cross-Origin Resource Sharing) spec which allows cross-domain XHR is pretty well supported.
Basically, support is as follows: (According to a mix of browser documentation and my own tests for a project I'm working on)
Full support in:
Untested, but should be fully supported:
Limited support in:
Notably unsupported:
It's not a complete list, but it's every browser with userscript support I could find to test. I've already taken the time to cite my sources on the CORS wikipedia page if you want them.
The simplest solution I can think of would be to test for CORS and then fall back to JSONP so that people using a modern browser get a perfect experience and people using something older see the loading status as an unavoidable side-effect.
Here's the MDC page on how CORS works.