题
我是做长期投票与他和firefox不断pops了"装载"旋使页面似乎还没有完成的负载。是否有办法抑制这个吗?
我被告知,团队运行轨道有黑客对抑制这一点,但是寻找过Orbited.js 码我无法弄清楚它们是什么。任何帮助,将不胜感激。
解决方案
这是一个简单的修补程序。所有你所要做的就是开始用的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>
不隶属于 StackOverflow