如何在加载后使用greasemonkey调用页面上的函数 [英] How can I get greasemonkey to call a function on a page after it loads
本文介绍了如何在加载后使用greasemonkey调用页面上的函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个非常简单的greasemonkey脚本,我想在页面上调用已经存在的javascript函数。我已阅读文档,似乎没有任何工作
I have a very simple greasemonkey script that I want to call an already existing javascript function on the page. I've read the documentation and nothing seems to work
window.setTimeout(function() {
alert('test') // This alert works, but nothing after it does
myFunction() // undefined
window.myFunction() // undefined
document.myFunction() // undefined
}, 1000);
推荐答案
尝试使用:
unsafeWindow.myFunction( );
Try using: unsafeWindow.myFunction();
更多详情和信息 - http:// wiki .greasespot.net / UnsafeWindow
More details and info - http://wiki.greasespot.net/UnsafeWindow
这篇关于如何在加载后使用greasemonkey调用页面上的函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文