A web page uses an external script:
<script src="script/alerts.js" type="text/javascript"></script>
In this script file there is a function which I would like to modify/replace. The function looks like this:
function SayHello(msg1, msg2){
alert(msg1);
alert(msg2;
// just saying hi and doing something i don't want to
}
I want to change it into something like this:
function SayHello(msg1, msg2){
// not saying hello
// but i'm doing everything i want to
}
How can i do this without using unsafeWindow?
Note: the function must be executed in the content page scope, rather than in the Greasemonkey sandbox.