1 http://www.google.com.hk/url?sa=t
&rct=j
&q=%E6%9C%A8%E5%AD%90%E5%B1%8B
&source=web
&cd=1
&ved=0CGUQFjAA
&url=http%3A%2F%2Fwww.mzwu.com%2F
&ei=l7ilT_jBB8uSiQf99IGmAw
&usg=AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA
&cad=rja
访问不了 http://www.google.com.hk/,跳转自然也就不成功了。那能不能复制出链接原地址,再粘贴到地址栏打开?测试后发现复制的链接地址也是转换后的。
继续分析发现:Google对搜索链接地址的转换过程是在客户端进行的,准确的说是在鼠标按下时进行的:
鼠标按下前的链接:
1
<
a
onmousedown
="return rwt(this,'','','','1','AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA','','0CGUQFjAA',null,event)"
class
="l"
target
="_blank"
href
="http://www.mzwu.com/"
><
em
>木子屋
</
em
>-Dnawo's BLOG
</
a
>
鼠标按下后的链接:
1
<
a
onmousedown
="return rwt(this,'','','','1','AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA','','0CGUQFjAA',null,event)"
class
="l"
target
="_blank"
href
="http://www.google.com.hk/url?sa=t&rct=j&q=%E6%9C%A8%E5%AD%90%E5%B1%8B&source=web&cd=1&ved=0CGUQFjAA&url=http%3A%2F%2Fwww.mzwu.com%2F&ei=l7ilT_jBB8uSiQf99IGmAw&usg=AFQjCNFctvtehTHWHzB5A2MzvC7bM7qfpA&cad=rja"
><
em
>木子屋
</
em
>-Dnawo's BLOG
</
a
>
既然转换是在客户端进行,那我们就有办法阻止了,只需要改写rwt函数即可,使用GreaseMonkey很容易就能实现。
GreaseMonkey脚本:
1
//
==UserScript==
2 // @name StopRWT
3 // @namespace com.mzwu.www
4 // @description 阻止Google转换搜索链接地址
5 // @include http://www.google.com.hk*
6 // ==/UserScript==
7
8 var gcounter = 0;
9 var gtimer = window.setInterval( function(){
10 if(!!unsafeWindow.rwt){
11 unsafeWindow.rwt = function(){};
12 window.clearInterval(gtimer);
13 document.title = "阻止Google转换搜索链接地址成功!";
14 }
15 if(++gcounter==10){
16 window.clearInterval(gtimer);
17 }
18 },1000
19 );
2 // @name StopRWT
3 // @namespace com.mzwu.www
4 // @description 阻止Google转换搜索链接地址
5 // @include http://www.google.com.hk*
6 // ==/UserScript==
7
8 var gcounter = 0;
9 var gtimer = window.setInterval( function(){
10 if(!!unsafeWindow.rwt){
11 unsafeWindow.rwt = function(){};
12 window.clearInterval(gtimer);
13 document.title = "阻止Google转换搜索链接地址成功!";
14 }
15 if(++gcounter==10){
16 window.clearInterval(gtimer);
17 }
18 },1000
19 );
Firefox12.0下测试通过!Chrome用户安装扩展Tampermonkey也可以使用上边脚本。
相关阅读
[1].Firefox扩展Greasemonkey使用示例:
http://www.mzwu.com/article.asp?id=3091
[2].Greasemonkey:
http://www.greasespot.net/
[3].Tampermonkey:
http://tampermonkey.biniok.net/crx/tampermonkey_retro.crx
[4].Trixie:
http://www.bhelpuri.net/Trixie/