码迷,mamicode.com
首页 > Web开发 > 详细

greasemonkey修改网页url

时间:2014-12-01 00:50:58      阅读:294      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   io   ar   color   os   sp   java   

bubuko.com,布布扣
 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

 

greasemonkey修改网页url

标签:style   blog   http   io   ar   color   os   sp   java   

原文地址:http://www.cnblogs.com/cutepig/p/4134040.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!