JSONP Long Polling总是加载

Dav*_*ave 3 comet orbited long-polling

我正在使用JSONP进行长轮询,并且firefox不断弹出"正在加载"的微调器,使页面看起来好像还没有完成加载.有没有办法压制这个?

我被告知Orbited团队有抑制这个的黑客,但通过Orbited.js代码我无法弄清楚它们是什么.任何帮助将不胜感激.

Kel*_*ley 5

这是一个简单的修复..您所要做的就是使用setTimeout启动轮询请求.

这是我使用的一些代码..它使用jQuery,但我认为你可以弄清楚你需要什么,并使用你的库来做同样的事情.

<script type="text/javascript">
  function poll(){
    $.getJSON('/updates', function(json){
      //reconnect since we successfully received data and disconnected
      poll();

      //add something here to do whatever with the recieved data
    });
  }
  /*call the poll function after document has loaded with setTimeout
  if called before the document finishes loading completely it will
  cause a constant loading indication*/
  setTimeout(poll, 1);
</script>
Run Code Online (Sandbox Code Playgroud)