我怎样才能重定向一些页面的JavaScript在Greasemonkey? [英] How can I redirect some page with javascript in Greasemonkey?

查看:162
本文介绍了我怎样才能重定向一些页面的JavaScript在Greasemonkey?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



例如,当google.com完成加载时,我想发送一个javascript到搜索的东西...



我该怎么办?

解决方案



  // == UserScript == 
// @name重定向Google
// @namespace whatever.whatever ...
// @description将Google重定向到Yahoo!
// @include http://www.google.com
// @include http://www.google.com/*
// @include http:// *。 google.com/*
// == / UserScript ==
window.location =http://www.yahoo.com

...当然取代Google和Yahoo!与其他东西的网址。你不需要任何外部库(jQuery)或类似的东西。



我不会推荐这个,因为它更像是一个麻烦,而不是帮助最终用户,但这取决于脚本的功能是什么。


Hey, I want to redirect a page when it finish loading...

For example, when google.com finish loading, I want to send a javascript to search something...

How can I do it ?

解决方案

This is simply how I would go about redirecting:

//==UserScript==
// @name Redirect Google
// @namespace whatever.whatever...
// @description Redirect Google to Yahoo!
// @include http://www.google.com
// @include http://www.google.com/*
// @include http://*.google.com/*
//==/UserScript==
window.location = "http://www.yahoo.com"

... of course replacing the Google and Yahoo! URLs with something else. You don't need any external libraries (jQuery) or something complicated like that.

I would not reccomend this as it is more of a nuisance than a help to the end user, however that depends on what the function of the script is.

这篇关于我怎样才能重定向一些页面的JavaScript在Greasemonkey?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆