• <legend id='U6gcZ'><style id='U6gcZ'><dir id='U6gcZ'><q id='U6gcZ'></q></dir></style></legend>

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

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

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

        AJAX 请求和普通浏览器请求的区别

        时间:2023-10-14

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

          • <bdo id='jInDm'></bdo><ul id='jInDm'></ul>

              <i id='jInDm'><tr id='jInDm'><dt id='jInDm'><q id='jInDm'><span id='jInDm'><b id='jInDm'><form id='jInDm'><ins id='jInDm'></ins><ul id='jInDm'></ul><sub id='jInDm'></sub></form><legend id='jInDm'></legend><bdo id='jInDm'><pre id='jInDm'><center id='jInDm'></center></pre></bdo></b><th id='jInDm'></th></span></q></dt></tr></i><div id='jInDm'><tfoot id='jInDm'></tfoot><dl id='jInDm'><fieldset id='jInDm'></fieldset></dl></div>
              <tfoot id='jInDm'></tfoot><legend id='jInDm'><style id='jInDm'><dir id='jInDm'><q id='jInDm'></q></dir></style></legend>
                  <tbody id='jInDm'></tbody>
                • 本文介绍了AJAX 请求和普通浏览器请求的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  AJAX 请求和直接浏览器请求之间有区别吗(就网页的调用和加载方式而言)?

                  Is there a difference between an AJAX request and a direct browser request (in terms of how a web page is called and loaded)?

                  换句话说,我的意思是:直接服务器端请求的处理方式是否不同于客户端请求(由浏览器发起)?

                  In other words, I mean: is a direct server-side request handled in any way differently than a client-side request (initiated by the browser)?

                  推荐答案

                  就服务器而言,AJAX 请求与正常"浏览器请求相同,除了可能略有不同的 HTTP 标头.例如chrome 发送:

                  An AJAX request is identical to a "normal" browser request as far as the server is concerned other than potentially slightly different HTTP headers. e.g. chrome sends:

                  X-Requested-With:XMLHttpRequest
                  

                  我不确定该标头是否标准化,或者它是否在每个浏览器中都不同,甚至是否在每个浏览器中都包含 .

                  I'm not sure if that header is standardized or not, or if it's different in every browser or even included at all in every browser.

                  我收回这一点,该标头是由 jQuery(可能还有其他 JS 库)发送的,而不是由浏览器发送的,如下所示:

                  edit: I take that back, that header is sent by jQuery (and likely other JS libraries), not the browser as is evidenced by:

                  var xhr = new XMLHttpRequest();
                  xhr.open('GET', '/');
                  xhr.send();
                  

                  发送:

                  Accept:*/*
                  Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
                  Accept-Encoding:gzip,deflate,sdch
                  Accept-Language:en-US,en;q=0.8
                  Connection:keep-alive
                  Cookie: ....
                  Host:stackoverflow.com
                  If-Modified-Since:Sat, 31 Dec 2011 01:57:24 GMT
                  Referer:http://stackoverflow.com/questions/8685750/how-does-an-ajax-request-differ-from-a-normal-browser-request/8685758
                  User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11
                  

                  这使我得出结论,默认情况下绝对没有区别.

                  which leads me to the conclusion that by default there is absolutely no difference.

                  这篇关于AJAX 请求和普通浏览器请求的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:XHR responseText 是空字符串 下一篇:如何调试通过 AJAX(特别是 jQuery)加载的 Javascript

                  相关文章

                  最新文章

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

                    1. <small id='iYDSc'></small><noframes id='iYDSc'>

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