greasemonkey修改网页url

复制代码
 1 // ==UserScript==
 2 // @name        JSHE_ModifyFunction
 3 // @namespace   jshe
 4 // @include     http://localhost/*
 5 // @version     1
 6 // @grant       none
 7 // ==/UserScript==
 8 
 9 alert("hello2");
10 
11 function embed() {
12     var cells =document.getElementsByTagName("a");
13     for (var i = 0; i < cells.length; i++) 
14     {
15         var href = cells[i].getAttribute("href"); 
16         cells[i].setAttribute("href", href + "/dummy"); 
17     }
18 }
19 
20 
21 var script = document.createElement('script'); 
22 script.type = "text/javascript"; 
23 //script.innerHTML = "(" + embed + ")()";
24 script.innerHTML = embed + "\nembed();";
25 document.getElementsByTagName('body')[0].appendChild(script);
26 
27 alert("hello3");
View Code
复制代码

 

posted on   cutepig  阅读(450)  评论(0编辑  收藏  举报

导航

< 2025年1月 >
29 30 31 1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示