Uninote
Uninote
用户根目录
每日点滴

<!DOCTYPE html> <html><head><meta http-equiv='Content-Type' content='text/html; charset=utf8'><title>fiddler</title> <script> var g_resRoot = '../../__res/'; var g_json_outline = '{"children":[{"children":[],"level":1,"lvNumber":"1","text":"替换baidu的jquery"}],"level":0,"lvNumber":"","text":"fiddler"}'; </script> <link rel='stylesheet' type='text/css' href='../../__res/common.css'><style>.s0{color:#000000;} .s1{color:#000000;} </style> </head><body> <script src='../../__res/util.js'></script><div id='outline'> <li><a href='#ol_0' style='font-weight:bold; font-size:22px'>fiddler</a></li> <li> <a href='#ol_1' >替换baidu的jquery</a></li> </div>

<pre id='ol_0' class='title'>fiddler</pre> <pre><d class='s0'></d></pre> <h1 id='ol_1'>替换baidu的jquery</h1> <pre><d class='s0'></d></pre> <pre><d class='s0'>1、安装fiddler,并启用https监听(Tools->Options->Https)</d></pre> <pre><d class='s0'><img src='..\pic\db21f9294020dd4f18355b95df16cc1f.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>2、选中AutoRepsonder,Enable rules,点击Add Rule:</d></pre> <pre><d class='s0'><img src='..\pic\5d90e9110d6c26e2885ecdbed8f3b866.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>在底部的Rule Editor分别填上:</d></pre> <pre><d class='s0'>REGEX:https://.*.bdstatic.com/.jquery-1.10.2..js</d></pre> <pre><d class='s0'>C:\Users\Administrator\Desktop\replace.js</d></pre> <pre><d class='s0'><img src='..\pic\43e62ba7546f422522361c336cd10159.jpg' /></d><d class='s0'></d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>这句话的意思是,凡是匹配上这个正则表达式的请求,都会被用C:\Users\Administrator\Desktop\replace.js这个文件替换。这个正则表达式匹配的是百度的各种jquery.js,比如,我们可以将百度原始的<a href='https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/jquery/jquery-1.10.2.min_65682a2.js'>jquery</a>的内容复制到replace.js,再在最后添加以下代码:</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>$(function() {</d></pre> <pre><d class='s0'> setTimeout(function() {</d></pre> <pre><d class='s0'> // $("#page > a.n").click();</d></pre> <pre><d class='s0'> var obj = $("#page > a.n");</d></pre> <pre><d class='s0'> var obj = obj.last();</d></pre> <pre><d class='s0'> var s = "<a href='https://www.baidu.com'>https://www.baidu.com</a>" + obj.attr("href");</d></pre> <pre><d class='s0'> console.log(obj.text());</d></pre> <pre><d class='s0'> console.log(s);</d></pre> <pre><d class='s0'> window.location.href = s;</d></pre> <pre><d class='s0'> }, 1000);</d></pre> <pre><d class='s0'></d></pre> <pre><d class='s0'>});</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'><a href='https://www.baidu.com/s?wd=ss&pn=20&oq=ss&ie=utf-8&rsv_idx=1&rsv_pq=eec83645000319d1&rsv_t=fca0NFHrDJl2vip8nG4zonoFlfTfqVo0ZXAXaSMaWOtezBD1elYMfXKIj6g&rsv_page=1'>打开测试页面</a>试试效果吧(百度会自动翻页)。</d></pre> <pre><d class='s1'></d></pre> <pre><d class='s1'>如果没有效果,尝试禁用缓存:</d></pre> <pre><d class='s1'><img src='..\pic\5265b7b96e60d784bc3d3e9061baa372.jpg' /></d><d class='s1'></d></pre> <pre><d class='s1'></d></pre> </body></html>

dbdiffer

file_manager

点赞(0) 阅读(64) 举报
目录
标题