The jsonp comet hanging request causes an ugly “download” state in browsers

I use jsonp to execute comet requests in the cross-domain area, and the “download” status is really annoying.

Is there any way to suppress this with javascript?

For those not familiar with jsonp, it basically introduces a script tag, except in my case, I find the request on my server without returning the request until a later time.

At this time, the browser views my request as a download status.

I use this: http://code.google.com/p/jquery-jsonp/

Thanks in advance!

+2
source share
2 answers

, Javascript, , .

, , COMET, . XMLHttpRequest , , , CORS (Cross-Origin Resource Sharing), XHR, .

, : ( , )

:

  • Gecko 1.9.1+ (Firefox 3.5, SeaMonkey 2.0 .. Firefox 3.6.8 SeaMonkey 2.0.7)
  • WebKit (Safari 4+, Chrome 3+ .. , Safari 4 OSX, Safari 5 WinXP, Chrome 5.0.375.127 ( ), Midori 0.2.7, Flock, Epiphany 2.30.2, luakit uzbl)

, :

:

  • Internet Explorer 8 ( Microsoft XDomainRequest() , , cookie )
  • Sleipnir ( , MSHTML-)

:

  • Opera ( 11.01.1190, )
  • Camino ( 2.0.5, Gecko 1.9.0 (Firefox 3.0))
  • Arora ( 0.10.2, API WebKit CORS, , )
  • , Mozilla Flock ( Gecko 1.9.0 (Firefox 3.0))

, userscript, . , CORS wikipedia, .

, , - CORS, JSONP, , , , , - , .

MDC CORS.

+1

, .

$(function () {
    setTimeout(function () {
        $.jsonp(...)
    }, 1000);
});
+2

Source: https://habr.com/ru/post/1739365/


All Articles