<tfoot id='L1AKT'></tfoot>
  1. <small id='L1AKT'></small><noframes id='L1AKT'>

  2. <legend id='L1AKT'><style id='L1AKT'><dir id='L1AKT'><q id='L1AKT'></q></dir></style></legend>
    • <bdo id='L1AKT'></bdo><ul id='L1AKT'></ul>
      <i id='L1AKT'><tr id='L1AKT'><dt id='L1AKT'><q id='L1AKT'><span id='L1AKT'><b id='L1AKT'><form id='L1AKT'><ins id='L1AKT'></ins><ul id='L1AKT'></ul><sub id='L1AKT'></sub></form><legend id='L1AKT'></legend><bdo id='L1AKT'><pre id='L1AKT'><center id='L1AKT'></center></pre></bdo></b><th id='L1AKT'></th></span></q></dt></tr></i><div id='L1AKT'><tfoot id='L1AKT'></tfoot><dl id='L1AKT'><fieldset id='L1AKT'></fieldset></dl></div>
    1. XMLHttpRequest 浏览器支持

      XMLHttpRequest Browser Support(XMLHttpRequest 浏览器支持)

      <small id='ArG7z'></small><noframes id='ArG7z'>

      <legend id='ArG7z'><style id='ArG7z'><dir id='ArG7z'><q id='ArG7z'></q></dir></style></legend>

            <bdo id='ArG7z'></bdo><ul id='ArG7z'></ul>
              <tbody id='ArG7z'></tbody>
          • <tfoot id='ArG7z'></tfoot>
              <i id='ArG7z'><tr id='ArG7z'><dt id='ArG7z'><q id='ArG7z'><span id='ArG7z'><b id='ArG7z'><form id='ArG7z'><ins id='ArG7z'></ins><ul id='ArG7z'></ul><sub id='ArG7z'></sub></form><legend id='ArG7z'></legend><bdo id='ArG7z'><pre id='ArG7z'><center id='ArG7z'></center></pre></bdo></b><th id='ArG7z'></th></span></q></dt></tr></i><div id='ArG7z'><tfoot id='ArG7z'></tfoot><dl id='ArG7z'><fieldset id='ArG7z'></fieldset></dl></div>
              1. 本文介绍了XMLHttpRequest 浏览器支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                以下代码段在 IE7 中不起作用是否有原因?

                Is there a reason the following snippet would not work in IE7?

                var http = new XMLHttpRequest();
                var url = 'http://my_site.com/';
                var obj = createJsonParamsObj();
                http.open("POST", url, true);
                http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                http.send(JSON.stringify(obj));
                

                从文档看来, new XMLHttpRequest() 应该可以工作,但我有疑问,因为我无法测试它(仅在兼容模式下)所以也许我最好使用 new ActiveXObject.

                From the documentation it seems like the new XMLHttpRequest() should work, but have doubts since I can't test it (only in compatibility mode) so perhaps I better use new ActiveXObject.

                推荐答案

                在 google 中搜索一下就能很好地解决您的基本问题

                a small search in google would provide a good answer for your basic problem

                /*
                   Provide the XMLHttpRequest constructor for Internet Explorer 5.x-6.x:
                   Other browsers (including Internet Explorer 7.x-9.x) do not redefine
                   XMLHttpRequest if it already exists.
                
                   This example is based on findings at:
                   http://blogs.msdn.com/xmlteam/archive/2006/10/23/using-the-right-version-of-msxml-in-internet-explorer.aspx
                */
                if (typeof XMLHttpRequest === "undefined") {
                  XMLHttpRequest = function () {
                    try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
                    catch (e) {}
                    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
                    catch (e) {}
                    try { return new ActiveXObject("Microsoft.XMLHTTP"); }
                    catch (e) {}
                    // Microsoft.XMLHTTP points to Msxml2.XMLHTTP and is redundant
                    throw new Error("This browser does not support XMLHttpRequest.");
                  };
                }
                

                /** 
                 * Gets an XMLHttpRequest. For Internet Explorer 6, attempts to use MSXML 6.0,
                 * then falls back to MXSML 3.0.
                 * Returns null if the object could not be created. 
                 * @return {XMLHttpRequest or equivalent ActiveXObject} 
                 */ 
                function getXHR() { 
                  if (window.XMLHttpRequest) {
                    // Chrome, Firefox, IE7+, Opera, Safari
                    return new XMLHttpRequest(); 
                  } 
                  // IE6
                  try { 
                    // The latest stable version. It has the best security, performance, 
                    // reliability, and W3C conformance. Ships with Vista, and available 
                    // with other OS's via downloads and updates. 
                    return new ActiveXObject('MSXML2.XMLHTTP.6.0');
                  } catch (e) { 
                    try { 
                      // The fallback.
                      return new ActiveXObject('MSXML2.XMLHTTP.3.0');
                    } catch (e) { 
                      alert('This browser is not AJAX enabled.'); 
                      return null;
                    } 
                  } 
                }
                

                参考:http://en.wikipedia.org/wiki/XMLHttpRequest 和 http://www.webmasterworld.com/javascript/4027629.htm

                这篇关于XMLHttpRequest 浏览器支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                SCRIPT5: Access is denied in IE9 on xmlhttprequest(SCRIPT5:在 IE9 中对 xmlhttprequest 的访问被拒绝)
                XMLHttpRequest module not defined/found(XMLHttpRequest 模块未定义/未找到)
                Show a progress bar for downloading files using XHR2/AJAX(显示使用 XHR2/AJAX 下载文件的进度条)
                How can I open a JSON file in JavaScript without jQuery?(如何在没有 jQuery 的情况下在 JavaScript 中打开 JSON 文件?)
                How do I get the HTTP status code with jQuery?(如何使用 jQuery 获取 HTTP 状态码?)
                quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
                <legend id='0YhB2'><style id='0YhB2'><dir id='0YhB2'><q id='0YhB2'></q></dir></style></legend>
                  <bdo id='0YhB2'></bdo><ul id='0YhB2'></ul>
                        <tbody id='0YhB2'></tbody>

                      1. <small id='0YhB2'></small><noframes id='0YhB2'>

                        <i id='0YhB2'><tr id='0YhB2'><dt id='0YhB2'><q id='0YhB2'><span id='0YhB2'><b id='0YhB2'><form id='0YhB2'><ins id='0YhB2'></ins><ul id='0YhB2'></ul><sub id='0YhB2'></sub></form><legend id='0YhB2'></legend><bdo id='0YhB2'><pre id='0YhB2'><center id='0YhB2'></center></pre></bdo></b><th id='0YhB2'></th></span></q></dt></tr></i><div id='0YhB2'><tfoot id='0YhB2'></tfoot><dl id='0YhB2'><fieldset id='0YhB2'></fieldset></dl></div>
                        1. <tfoot id='0YhB2'></tfoot>