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);
Try using: unsafeWindow.myFunction();
More details and info – http://wiki.greasespot.net/UnsafeWindow