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

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

        从 XHR 获取响应 Content-Type 标头

        时间:2023-10-13

      1. <legend id='UyJ8W'><style id='UyJ8W'><dir id='UyJ8W'><q id='UyJ8W'></q></dir></style></legend>
            1. <small id='UyJ8W'></small><noframes id='UyJ8W'>

                <tbody id='UyJ8W'></tbody>
                <tfoot id='UyJ8W'></tfoot>

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

                • 本文介绍了从 XHR 获取响应 Content-Type 标头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想看看标题是 text/html 还是 text/xml.如果它是 text/html 则有一个错误,我宁愿在继续之前抓住它.

                  I would like to see whether the header was text/html or text/xml. If it was text/html then there was an error and I would rather catch that before proceeding.

                  推荐答案

                  使用 getResponseHeader() 方法.

                  小例子:

                  <script>
                  function hand () {
                          console.log(this.getResponseHeader('content-type'));
                  }
                  var x = new XMLHttpRequest();
                  x.onreadystatechange = hand;
                  x.open('GET', 'index.html', true);
                  x.send();
                  </script>
                  

                  这篇关于从 XHR 获取响应 Content-Type 标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:加载外部数据时,控制台提示:XHR 完成加载 下一篇:AJAX Web 应用程序中是否需要表单标签?

                  相关文章

                  最新文章

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

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

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

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