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

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

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

      xmlhttprequest 状态 302 的问题

      Problems with xmlhttprequest status 302(xmlhttprequest 状态 302 的问题)

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

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

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

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

                问题描述

                限时送ChatGPT账号..

                我正在尝试获取链接 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 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                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 文件?)
                quot;Origin null is not allowed by Access-Control-Allow-Originquot; in Chrome. Why?(“Access-Control-Allow-Origin 不允许 Origin null在铬.为什么?)
                How to get response url in XMLHttpRequest?(如何在 XMLHttpRequest 中获取响应 url?)
                  <tbody id='6Lati'></tbody>

                  <legend id='6Lati'><style id='6Lati'><dir id='6Lati'><q id='6Lati'></q></dir></style></legend>

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

                          <small id='6Lati'></small><noframes id='6Lati'>