pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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

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

        檢索和修改 XMLHttpRequest 的內(nèi)容

        Retrieve and Modify content of an XMLHttpRequest(檢索和修改 XMLHttpRequest 的內(nèi)容)

            <bdo id='93Bz5'></bdo><ul id='93Bz5'></ul>

            <tfoot id='93Bz5'></tfoot>

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

                <small id='93Bz5'></small><noframes id='93Bz5'>

                  <tbody id='93Bz5'></tbody>

                <legend id='93Bz5'><style id='93Bz5'><dir id='93Bz5'><q id='93Bz5'></q></dir></style></legend>
                  本文介紹了檢索和修改 XMLHttpRequest 的內(nèi)容的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我正在為 Firefox、Safari、Chrome 開發(fā)一個瀏覽器插件,它將攔截頁面上的數(shù)據(jù),針對正則表達式運行它,然后如果匹配 - 重新格式化它.我使用以下方法處理頁面加載:

                  I am working on a browser plugin for Firefox, Safari, Chrome that will intercept data on the page, run it against a regex and then if it matches - reformat it. I have this working on page load using:

                  var meth = {
                    replaceInElement : function(element, find, replace) {
                          // iterate over child nodes and replace
                    },
                    run : function(evt){
                      // doc is the document that triggered "run" event
                      if (!(evt.target.nodeName === "#document")) { return; }
                      var doc = evt.target; // document that triggered "onload" event
                      if (!(doc instanceof HTMLDocument)) { return; }
                      if (!doc.location) { return; }
                  
                      // perform substitutions on the loaded document
                      var find = /regex/gi
                  
                      meth.replaceInElement(doc.body, find, function(match) {
                          var new_content;
                          //do stuff
                          return new_content;
                      });
                  
                      //content.document.addEventListener('DOMNodeInserted', ezcall.node_inserted, false);
                    }
                  }
                  
                  window.addEventListener("load", meth.run, false);
                  

                  這適用于靜態(tài)頁面,但對于使用 ajax 調(diào)用的任何內(nèi)容,它都會失敗.我找不到合適的偵聽器或弄清楚如何攔截 XMLHttpRequest.

                  This is working for static pages, but for anything using ajax calls, it fails. I cannot find the right listener or figure out how to intercept the XMLHttpRequest.

                  我為 XMLHttpRequest 嘗試了類似的事件偵聽器,但沒有成功.

                  I have tried similar event listeners for XMLHttpRequest with no luck.

                  XMLHttpRequest.addEventListener('load', meth.run, false);
                  

                  我想攔截請求并修改內(nèi)容.或者找到更新的目標,在ajax調(diào)用完成后掃描.

                  I would like to either intercept the request and modify the content. Or find the target that was updated and scan it after the ajax call is finished.

                  更新:

                  我會接受無法完成的回答,但我需要一些支持數(shù)據(jù)來說明為什么無法完成.

                  I will accept an answer that says it cannot be done, but I will need some supporting data as to why it cannot be done.

                  推薦答案

                  比較臟但是你可以覆蓋XMLHttpRequest.prototype.open.這是一個演示頁面.由于您正在編寫擴展程序,因此您必須將此代碼放在頁面上下文中:

                  Rather dirty but you can overwrite XMLHttpRequest.prototype.open. Here is a Demo page. Since you're writing an extension, you must put this code in page context:

                  (function() {
                      // save reference to the native method
                      var oldOpen = XMLHttpRequest.prototype.open;
                      // overwrite open with our own function
                      XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
                          // intercept readyState changes
                          this.addEventListener("readystatechange", function() {
                              // your code goes here...
                              console.log("Interception :) " + this.readyState);
                          }, false);
                          // finally call the original open method
                          oldOpen.call(this, method, url, async, user, pass);
                      };
                  })();
                  

                  在這之后你可以做任何我猜的事情.替換 instance.readystatechange,替換 instance.addEventListener,或者監(jiān)聽突變事件(雖然它們是 已棄用).

                  After this you can do anything I guess. Replace instance.readystatechange, replace instance.addEventListener, or listen to mutation events (although they are deprecated).

                  這篇關(guān)于檢索和修改 XMLHttpRequest 的內(nèi)容的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  Browser waits for ajax call to complete even after abort has been called (jQuery)(即使在調(diào)用 abort (jQuery) 之后,瀏覽器也會等待 ajax 調(diào)用完成)
                  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屋-程序員軟件開發(fā)技術(shù)分
                  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 部分內(nèi)容)
                  <tfoot id='ESb4B'></tfoot>

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

                      <tbody id='ESb4B'></tbody>

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

                          1. <legend id='ESb4B'><style id='ESb4B'><dir id='ESb4B'><q id='ESb4B'></q></dir></style></legend>
                            主站蜘蛛池模板: 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 | 全国国际化学校_国际高中招生_一站式升学择校服务-国际学校网 | 江西自考网-江西自学考试网 | 南京种植牙医院【官方挂号】_南京治疗种植牙医院那个好_南京看种植牙哪里好_南京茀莱堡口腔医院 尼龙PA610树脂,尼龙PA612树脂,尼龙PA1010树脂,透明尼龙-谷骐科技【官网】 | 诚暄电子公司首页-线路板打样,pcb线路板打样加工制作厂家 | 期货软件-专业期货分析软件下载-云智赢 | 清水-铝合金-建筑模板厂家-木模板价格-铝模板生产「五棵松」品牌 | 电杆荷载挠度测试仪-电杆荷载位移-管桩测试仪-北京绿野创能机电设备有限公司 | 许昌奥仕达自动化设备有限公司 | 恒温恒湿箱(药品/保健品/食品/半导体/细菌)-兰贝石(北京)科技有限公司 | 哈希PC1R1A,哈希CA9300,哈希SC4500-上海鑫嵩实业有限公司 | 自动钻孔机-全自动数控钻孔机生产厂家-多米(广东)智能装备有限公司 | 体感VRAR全息沉浸式3D投影多媒体展厅展会游戏互动-万展互动 | 热缩管切管机-超声波切带机-织带切带机-无纺布切布机-深圳市宸兴业科技有限公司 | 板材品牌-中国胶合板行业十大品牌-环保板材-上海声达板材 | 选矿设备-新型重选设备-金属矿尾矿重选-青州冠诚重工机械有限公司 | 手持式线材张力计-套帽式风量罩-深圳市欧亚精密仪器有限公司 | 保温杯,儿童婴童奶瓶,运动水壶「广告礼品杯定制厂家」超朗保温杯壶 | 数控走心机-走心机价格-双主轴走心机-宝宇百科 | 全自动定氮仪-半自动凯氏定氮仪厂家-祎鸿仪器 | 运动木地板厂家,篮球场木地板品牌,体育场馆木地板安装 - 欧氏运动地板 | 混合生育酚_醋酸生育酚粉_琥珀酸生育酚-山东新元素生物科技 | 欧洲MV日韩MV国产_人妻无码一区二区三区免费_少妇被 到高潮喷出白浆av_精品少妇自慰到喷水AV网站 | led全彩屏-室内|学校|展厅|p3|户外|会议室|圆柱|p2.5LED显示屏-LED显示屏价格-LED互动地砖屏_蕙宇屏科技 | 天津仓储物流-天津电商云仓-天津云仓一件代发-博程云仓官网 | 液压油缸生产厂家-山东液压站-济南捷兴液压机电设备有限公司 | 宿舍管理系统_智慧园区系统_房屋/房产管理系统_公寓管理系统 | 北京开源多邦科技发展有限公司官网| 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 通风气楼_通风天窗_屋顶风机-山东美创通风设备有限公司 | 除尘器布袋骨架,除尘器滤袋,除尘器骨架,电磁脉冲阀膜片,卸灰阀,螺旋输送机-泊头市天润环保机械设备有限公司 | 网站优化公司_SEO优化_北京关键词百度快速排名-智恒博网络 | 手板-手板模型-手板厂-手板加工-生产厂家,[东莞创域模型] | 釜溪印象网络 - Powered by Discuz! | 水冷式工业冷水机组_风冷式工业冷水机_水冷螺杆冷冻机组-深圳市普威机械设备有限公司 | 东风体检车厂家_公共卫生体检车_医院体检车_移动体检车-锦沅科贸 | 整车VOC采样环境舱-甲醛VOC预处理舱-多舱法VOC检测环境仓-上海科绿特科技仪器有限公司 | 提升海外网站流量,增加国外网站访客UV,定制海外IP-访客王 | 空压机网_《压缩机》杂志| 七维官网-水性工业漆_轨道交通涂料_钢结构漆| 反渗透水处理设备|工业零排放|水厂设备|软化水设备|海南净水设备--海南水处理设备厂家 |