简体   繁体   English

浏览器加载指示器永不停止旋转IE10

[英]Browser loading indicator never stops spinning IE10

On my site I have an iframe with a self executing javascript Chatt function in it. 在我的网站上,我有一个iframe,其中包含一个自执行的JavaScript Chatt函数。 This script have a few setIntervals, callbacks and communicate with my NodeJs server using PushStream. 该脚本具有一些setIntervals,回调,并使用PushStream与我的NodeJs服务器通信。

It works fine in all browsers but in, IE10 the Browser loading indicator never stops spinning, the script still works fine, but how do i get the indicator to stop? 在所有浏览器中都可以正常运行,但是在IE10中,浏览器加载指示器永远不会停止旋转,脚本仍然可以正常运行,但是如何使指示器停止运行?

What is different in IE10 then all the others? IE10和其他所有有什么不同?

The script is a few hundred lines, but here is the file. 该脚本有几百行,但这是文件。 http://westerlundh.se/cc.js http://westerlundh.se/cc.js

Thanks 谢谢

If you have any code that runs for a long time as soon as the page is ready to execute JS this can cause the browser to keep displaying the loading indicator. 如果您有任何代码可以在页面准备好执行JS后立即运行很长时间,这可能会导致浏览器继续显示加载指示符。 Safari does/used to suffer from this issue too. Safari确实/曾经也遭受过此问题的困扰。 A quick, but a little ugly, solution is to surround your initial code in a setTimeout . 一个快速但有点难看的解决方案是将您的初始代码包含在setTimeout For instance 例如

setTimeout(function(){
    //The code to run when the page loads
},10);

This will force IE into believing all the code that needed to be run for the page to be loaded has been run. 这将迫使IE相信已运行要加载的页面所需的所有代码。 A common cause of this (and appears to be the case for you) can be AJAX polling. 一个常见的原因(似乎是您的情况)可能是AJAX轮询。 Starting the first long-poll when the page is loaded causes the loading icon to display for the duration of the AJAX request being open, then starting another poll again just extends the length of time the loading icon is shown, thus looking like the page is not finished loading. 加载页面时开始第一个长轮询会导致在打开AJAX请求期间显示加载图标,然后再次开始另一个轮询只会延长显示加载图标的时间,因此页面看起来像尚未完成加载。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM