<bdo id='gmWSa'></bdo><ul id='gmWSa'></ul>

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

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

      <tfoot id='gmWSa'></tfoot>

    2. <legend id='gmWSa'><style id='gmWSa'><dir id='gmWSa'><q id='gmWSa'></q></dir></style></legend>
    3. XMLHttpRequest Post 上的 send() 数据参数的最大长度

      时间:2023-10-14
      <tfoot id='9bku8'></tfoot>

        <bdo id='9bku8'></bdo><ul id='9bku8'></ul>
      • <small id='9bku8'></small><noframes id='9bku8'>

          <tbody id='9bku8'></tbody>

              <i id='9bku8'><tr id='9bku8'><dt id='9bku8'><q id='9bku8'><span id='9bku8'><b id='9bku8'><form id='9bku8'><ins id='9bku8'></ins><ul id='9bku8'></ul><sub id='9bku8'></sub></form><legend id='9bku8'></legend><bdo id='9bku8'><pre id='9bku8'><center id='9bku8'></center></pre></bdo></b><th id='9bku8'></th></span></q></dt></tr></i><div id='9bku8'><tfoot id='9bku8'></tfoot><dl id='9bku8'><fieldset id='9bku8'></fieldset></dl></div>
            1. <legend id='9bku8'><style id='9bku8'><dir id='9bku8'><q id='9bku8'></q></dir></style></legend>
              1. 本文介绍了XMLHttpRequest Post 上的 send() 数据参数的最大长度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                对于主要浏览器实现,您可以在 XMLHttpRequest 的 send 方法中使用的字符串数据长度是否有文档记录?

                Is there a documented max to the length of the string data you can use in the send method of an XMLHttpRequest for the major browser implementations?

                当数据超过大约 3k 时,我遇到了 JavaScript XMLHttpRequest Post 在 FireFox 3 中失败的问题.我假设 Post 的行为与传统的 Form Post 相同.

                I am running into an issue with a JavaScript XMLHttpRequest Post failing in FireFox 3 when the data is over approx 3k. I was assuming the Post would behave the same as a conventional Form Post.

                W3C 文档提到 send 方法的数据参数是 DOMString,但我不确定主流浏览器是如何实现的.

                The W3C docs mention the data param of the send method is a DOMString but I am not sure how the major browsers implement that.

                这是我的 JavaScript 的简化版本,如果 bigText 超过 3k 则失败,否则它可以工作...

                Here is a simplified version of my JavaScript, if bigText is over about 3k it fails, otherwise it works...

                var xhReq = createXMLHttpRequest();
                
                function createXMLHttpRequest() {
                  try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
                  try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
                  try { return new XMLHttpRequest(); } catch(e) {}
                  alert("XMLHttpRequest not supported");
                  return null;
                }
                
                function mySubmit(id, bigText) {
                  var url    = "SubmitPost.cfm";
                  var params = "id=" + id + "&bigtext=" + encodeURI(bigText);
                
                  xhReq.open("POST", url, true);
                
                  //Send the header information along with the request
                  xhReq.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                  xhReq.setRequestHeader("Content-length", params.length);
                  xhReq.setRequestHeader("Connection", "close");
                
                  xhReq.onreadystatechange = onPostSubmit;
                  xhReq.send(params);
                }
                
                function onPostSubmit() {
                
                  if (xhReq.readyState==4 || xhReq.readyState=="complete")
                     { 
                     if (xhReq.status != 200)
                        {
                        alert('BadStatus');
                        return;
                        }
                    } 
                }
                

                推荐答案

                我相信最大长度不仅取决于浏览器,还取决于网络服务器.例如,Apache HTTP 服务器有一个 LimitRequestBody 指令,它允许从 0 字节到 2GB 的数据.

                I believe the maximum length depends not only on the browser, but also on the web server. For example, the Apache HTTP server has a LimitRequestBody directive which allows anywhere from 0 bytes to 2GB worth of data.

                这篇关于XMLHttpRequest Post 上的 send() 数据参数的最大长度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:XMLHTTPRequest.status 在 FireFox 3.5 中返回 0 并且 resp 下一篇:重新创建 jQuery 的 ajaxStart 和 ajaxComplete 功能

                相关文章

                最新文章

              2. <small id='Jvs7U'></small><noframes id='Jvs7U'>

              3. <i id='Jvs7U'><tr id='Jvs7U'><dt id='Jvs7U'><q id='Jvs7U'><span id='Jvs7U'><b id='Jvs7U'><form id='Jvs7U'><ins id='Jvs7U'></ins><ul id='Jvs7U'></ul><sub id='Jvs7U'></sub></form><legend id='Jvs7U'></legend><bdo id='Jvs7U'><pre id='Jvs7U'><center id='Jvs7U'></center></pre></bdo></b><th id='Jvs7U'></th></span></q></dt></tr></i><div id='Jvs7U'><tfoot id='Jvs7U'></tfoot><dl id='Jvs7U'><fieldset id='Jvs7U'></fieldset></dl></div>
                  <bdo id='Jvs7U'></bdo><ul id='Jvs7U'></ul>
                  <legend id='Jvs7U'><style id='Jvs7U'><dir id='Jvs7U'><q id='Jvs7U'></q></dir></style></legend>

                    <tfoot id='Jvs7U'></tfoot>