• <small id='pd01r'></small><noframes id='pd01r'>

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

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

        <legend id='pd01r'><style id='pd01r'><dir id='pd01r'><q id='pd01r'></q></dir></style></legend><tfoot id='pd01r'></tfoot>
      1. xmlhttprequest 状态 302 的问题

        时间:2023-10-14

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

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

              • <bdo id='A4slW'></bdo><ul id='A4slW'></ul>
                <tfoot id='A4slW'></tfoot>

                <legend id='A4slW'><style id='A4slW'><dir id='A4slW'><q id='A4slW'></q></dir></style></legend>
                    <tbody id='A4slW'></tbody>
                  本文介绍了xmlhttprequest 状态 302 的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试获取链接 megaupload 中的真实路径,但总是这样,但这不起作用.

                  I am trying to get real path in link megaupload but always but this dont work.

                  function getRealURL(){
                  
                      var st = new String(""); 
                      var req = new XMLHttpRequest();
                      req.open("GET","http://www.megaupload.com/?d=6CKP1MVJ",true);
                      req.send(null);
                      req.send(null);
                      req.onreadystatechange = function (aEvt) {
                       if (req.readyState == 4) {
                          if(req.status == 302){
                            //SUCESSO
                             st = req.responseText;
                          }
                        }
                      };//funcao
                  
                      element.getElementById("id").setAttribute("value", st);
                  
                  }
                  

                  我需要这个链接:

                  Redirect to: http://www534.megaupload.com/files/c2c36829bc392692525f5b7b3d9d81dd/Coldplay - Warning Sign.mp3
                  

                  插入这个:

                  http://www.megaupload.com/?d=6CKP1MVJ
                  

                  推荐答案

                  XMLHttpRequest 默认自动跟随重定向,因此您看不到 302 响应.您需要将 nsIHttpChannel.redirectionLimit 属性设置为零以防止它:

                  XMLHttpRequest follows the redirect automatically by default so you don't see the 302 response. You need to set nsIHttpChannel.redirectionLimit property to zero to prevent it:

                  req.open("GET","http://www.megaupload.com/?d=6CKP1MVJ",true);
                  req.channel.QueryInterface(Components.interfaces.nsIHttpChannel).redirectionLimit = 0;
                  req.send(null);
                  

                  并不是说您在此处使用的链接会重定向到任何地方,但这是一般方法.顺便说一句,您应该查看 req.getResponseHeader("Location"),而不是查看重定向的响应文本.

                  Not that the link you use here redirects anywhere but this is the general approach. Btw, instead of looking at the response text for redirects you should look at req.getResponseHeader("Location").

                  这篇关于xmlhttprequest 状态 302 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:从 responseText 中获取特定内容 下一篇:xhr 发送 base64 字符串并在服务器中将其解码为文

                  相关文章

                  最新文章

                  <small id='4Cg4t'></small><noframes id='4Cg4t'>

                • <tfoot id='4Cg4t'></tfoot>

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

                    <bdo id='4Cg4t'></bdo><ul id='4Cg4t'></ul>
                  <legend id='4Cg4t'><style id='4Cg4t'><dir id='4Cg4t'><q id='4Cg4t'></q></dir></style></legend>