Chrome's loading indicator keeps spinning during XMLHttpRequest

后端 未结 4 2003
别那么骄傲
别那么骄傲 2020-12-13 06:56

I\'m writing an AJAX web app that uses Comet/Long Polling to keep the web page up to date, and I noticed in Chrome, it treats the page as if it\'s always loading (icon for t

4条回答
  •  隐瞒了意图╮
    2020-12-13 07:15

    use this function

    function getHTTPObject() {
     var xhr = false;
     if (window.XMLHttpRequest) {
      xhr = new XMLHttpRequest();
     } else if (window.ActiveXObject) {
      try {
       xhr = new ActiveXObject("Msxml2.XMLHTTP");
      } catch(e) {
       try {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
       } catch(e) {
        xhr = false;
       };
      };
     };
     return xhr;
    };
    

提交回复
热议问题