Greasemonkey修改网页url.

 1 // ==UserScript==
 2 // @name        test_ModifyFunction
 3 // @namespace   test
 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

 

Powered by Jekyll and Theme by solid

本站总访问量