Firefox:Dive Into Greasemonkey/4.19. Rewriting links
Mozilla中文Wiki
您的位置:Dive Into Greasemonkey → 公用模式 → 4.19. 改写链接
[编辑]
4.19. 改写链接
如果您找到了页面上的一个链接,您可以通过设置它的 href 属性来改写链接。
var a = document.getElementById('article');
if (a.href.match(/\?/i)) {
// link already contains other parameters, so append "&printer=1"
a.href += '&printer=1';
} else {
// link does not contain any parameters, so append "?printer=1"
a.href += '?printer=1';
}
[编辑]
实例
- Rotten Reviews (http://diveintogreasemonkey.org/download/rottenreviews.user.js)
- Stop The Presses (http://diveintogreasemonkey.org/download/stopthepresses.user.js)
← 获取当前域名
重定向页面 →

![[首页]](/stylesheets/images/wiki.png)