开发者

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

开发者 https://www.devze.com 2023-02-12 04:02 出处:网络
Here\'s a problem Google can\'t answer. I\'m doing some HTTP \"long polling\" with XMLHttpRequest for a multiplayer game.

Here's a problem Google can't answer. I'm doing some HTTP "long polling" with XMLHttpRequest for a multiplayer game. In Chrome, this causes the tab to always be "loading" : (1) the icon in the tab is开发者_StackOverflow社区 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"

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消