简体   繁体   English

我应该如何解决 Chrome 的 XMLHttpRequest 侵入性“加载”行为?

[英]How should I solve Chrome's XMLHttpRequest intrusive 'loading' behavior?

Here's a problem Google can't answer.这是 Google 无法回答的问题。 I'm doing some HTTP "long polling" with XMLHttpRequest for a multiplayer game.我正在使用 XMLHttpRequest 为多人游戏进行一些 HTTP“长轮询”。 In Chrome, this causes the tab to always be "loading" : (1) the icon in the tab is constantly playing the loading animation (2) the cursor is constantly an hourglass (3) the status persists forever at the bottom of the view area saying "contacting localhost"在 Chrome 中,这会导致选项卡始终“加载”:(1) 选项卡中的图标不断播放加载动画 (2) 光标始终是沙漏 (3) 状态永远存在于视图底部区域说“联系本地主机”

I was sure others have run into this, but I can't find them yet.我确信其他人已经遇到过这个问题,但我还找不到他们。

Try starting the first long poll slightly after the page loads, rather than directly in the page load event (use a short timeout triggered on page load).尝试在页面加载后稍微启动第一个长轮询,而不是直接在页面加载事件中(使用页面加载时触发的短超时)。 It seems like you need to give Chrome a few milliseconds to regain it's composure so it doesn't constantly look like it's loading.似乎您需要给 Chrome 几毫秒的时间来恢复它的镇静,这样它就不会一直看起来像是在加载。

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

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