久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  1. <i id='WVrg5'><tr id='WVrg5'><dt id='WVrg5'><q id='WVrg5'><span id='WVrg5'><b id='WVrg5'><form id='WVrg5'><ins id='WVrg5'></ins><ul id='WVrg5'></ul><sub id='WVrg5'></sub></form><legend id='WVrg5'></legend><bdo id='WVrg5'><pre id='WVrg5'><center id='WVrg5'></center></pre></bdo></b><th id='WVrg5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='WVrg5'><tfoot id='WVrg5'></tfoot><dl id='WVrg5'><fieldset id='WVrg5'></fieldset></dl></div>
  2. <small id='WVrg5'></small><noframes id='WVrg5'>

    1. <legend id='WVrg5'><style id='WVrg5'><dir id='WVrg5'><q id='WVrg5'></q></dir></style></legend>

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

      自定義 XMLHttpRequest.prototype.open

      custom XMLHttpRequest.prototype.open(自定義 XMLHttpRequest.prototype.open)
      • <tfoot id='HYVtI'></tfoot>
            <bdo id='HYVtI'></bdo><ul id='HYVtI'></ul>

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

            1. <legend id='HYVtI'><style id='HYVtI'><dir id='HYVtI'><q id='HYVtI'></q></dir></style></legend>

                <i id='HYVtI'><tr id='HYVtI'><dt id='HYVtI'><q id='HYVtI'><span id='HYVtI'><b id='HYVtI'><form id='HYVtI'><ins id='HYVtI'></ins><ul id='HYVtI'></ul><sub id='HYVtI'></sub></form><legend id='HYVtI'></legend><bdo id='HYVtI'><pre id='HYVtI'><center id='HYVtI'></center></pre></bdo></b><th id='HYVtI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='HYVtI'><tfoot id='HYVtI'></tfoot><dl id='HYVtI'><fieldset id='HYVtI'></fieldset></dl></div>
                  <tbody id='HYVtI'></tbody>
              1. 本文介紹了自定義 XMLHttpRequest.prototype.open的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                問題描述

                var open = XMLHttpRequest.prototype.open;
                
                XMLHttpRequest.prototype.open = function(method, uri, async, user, pass) {
                    this.addEventListener("readystatechange", function(event) {  
                    if(this.readyState == 4){
                       var self = this;
                       var response = {
                         method: method,
                         uri: uri,
                         responseText: self.responseText
                      };
                      console.log(response);  
                    } else {
                        console.log(this.readyState);
                    }
                    }, false);
                  open.call(this, method, uri, async, user, pass);
                };
                

                我正在嘗試在發送 XHR 之前收聽它們.$.ajax 方法中類似于 jQuery 的 beforeSend 方法.

                I am trying to listen for XHR before they are being sent. Something similar to jQuery's beforeSend in the $.ajax method.

                我的目標是在發送所有 XHR 之前監聽它們.我想最接近的方法是檢查上面是否 this.readyState === 1?

                My goal is to listen for all XHR's before they are being sent. I suppose the closest thing would be to check above if this.readyState === 1?

                上面的代碼是否會因為我在 XMLHttpRequest 上使用原型而導致任何 ajax 庫(如 jQuery)出現故障?

                Would the code above cause any ajax libraries like jQuery to malfunction because I use prototype on XMLHttpRequest?

                推薦答案

                我正在嘗試在發送 XHR 之前監聽它們.

                I am trying to listen for XHR before they are being sent.

                然后嘗試欺騙 send() 方法,而不是 open() 方法.

                Then try to spoof the send() method, not the open() one.

                上面的代碼是否會因為我在 XMLHttpRequest 上使用原型而導致任何 ajax 庫(如 jQuery)出現故障?

                Would the code above cause any ajax libraries like jQuery to malfunction because I use prototype on XMLHttpRequest?

                不,不是真的.只是,

                • 在那些庫選擇不使用 XMLHttpRequest(尤其是 IE)的情況下它不起作用
                • …如果瀏覽器不支持 XMLHttpRequest 對象(或不支持訪問或修改其原型),甚至會失敗
                • libs 可能能夠通過在你可以之前取消引用函數來解決你的欺騙問題(盡管我不知道有什么常見的 lib)
                • 您的代碼使用固定數量的參數調用本機方法,不確定這是否會影響任何內容,并且它不會重新返回結果(即使我們知道它是 undefined).為 100% 確定,請使用 return open.apply(this, arguments);.
                • it won't work where those libs choose not to use XMLHttpRequest (particularly IE)
                • …and even fail if the browser does not support the XMLHttpRequest object (or does not support accessing or modifying its prototype)
                • libs might be able to work around your spoof by dereferencing the functions before you can (though I don't know any common lib that does)
                • Your code calls the native method with a fixed number of arguments, not sure if that affects anything, and it does not re-return the result (even if we know it's undefined). To be 100% sure, use return open.apply(this, arguments);.

                這篇關于自定義 XMLHttpRequest.prototype.open的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                相關文檔推薦

                Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調用完成)
                JavaScript innerHTML is not working for IE?(JavaScript innerHTML 不適用于 IE?)
                XMLHttpRequest cannot load, No #39;Access-Control-Allow-Origin#39; header is present on the requested resource(XMLHttpRequest 無法加載,請求的資源上不存在“Access-Control-Allow-Origin標頭) - IT屋-程序員軟件開發技術分
                Is it possible for XHR HEAD requests to not follow redirects (301 302)(XHR HEAD 請求是否有可能不遵循重定向 (301 302))
                NETWORK_ERROR: XMLHttpRequest Exception 101(NETWORK_ERROR:XMLHttpRequest 異常 101)
                XMLHttpRequest 206 Partial Content(XMLHttpRequest 206 部分內容)
                  <bdo id='QllOd'></bdo><ul id='QllOd'></ul>
                    <tbody id='QllOd'></tbody>

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

                      1. <legend id='QllOd'><style id='QllOd'><dir id='QllOd'><q id='QllOd'></q></dir></style></legend>
                      2. <tfoot id='QllOd'></tfoot>
                        <i id='QllOd'><tr id='QllOd'><dt id='QllOd'><q id='QllOd'><span id='QllOd'><b id='QllOd'><form id='QllOd'><ins id='QllOd'></ins><ul id='QllOd'></ul><sub id='QllOd'></sub></form><legend id='QllOd'></legend><bdo id='QllOd'><pre id='QllOd'><center id='QllOd'></center></pre></bdo></b><th id='QllOd'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='QllOd'><tfoot id='QllOd'></tfoot><dl id='QllOd'><fieldset id='QllOd'></fieldset></dl></div>

                        1. 主站蜘蛛池模板: 天天躁人人躁人人躁狂躁 | 岛国在线免费观看 | 少妇精品久久久久久久久久 | 日本亚洲一区 | 久久一区精品 | 日韩欧美国产不卡 | 欧美a在线 | 欧美一区二区三区久久精品 | 国产精品永久免费 | 1000部精品久久久久久久久 | 欧洲av在线| 女生羞羞网站 | 免费毛片网 | 一区二区三区免费网站 | 精品视频在线免费观看 | 久久综合一区二区三区 | 久久久久久久久国产 | 亚洲在线 | 日日噜噜噜夜夜爽爽狠狠视频, | 国产精品福利网站 | 亚洲国产精品视频 | 中文字幕在线视频网站 | 在线免费毛片 | 东京久久 | 日本午夜一区二区三区 | 精品一区二区电影 | 亚洲欧美日韩精品久久亚洲区 | 国产一区在线免费 | 国产午夜精品久久 | 在线观看中文字幕一区二区 | 一区二区三区影院 | 黄瓜av | 日韩欧美亚洲 | 在线观看免费高清av | 亚洲天堂影院 | 亚洲协和影视 | 亚洲国产激情 | 国产精品永久久久久久久www | 久久精品亚洲一区 | 亚洲精品乱码久久久久久按摩 | 亚洲精品国产综合区久久久久久久 |