How to replace or remove inline javascript functions?
|
|
I'm a total newbie with greasemonkey (and Javascript in general)... I found the following source on a page that tries to disable the right-click context menu. Firefox doesn't actually let it disable the menu, but the popup alert is annoying and I'm trying to disable it: =================================
if (isIE4) document.oncontextmenu=putAlert;
I'm thinking that if I can replace the putAlert() function (or remove it entirely) it should accomplish the trick. However, I've been unable to figure out how to do this. Can anyone explain how this is done? Thanks! |
|
|
I believe it goes like this:
unsafeWindow.putAlert = function () {
var sorryMsg = "This souldn't appear because Greasemonkey can divide by zero.";
};
|
|
|
Thanks! That seems to work. I thought I'd tried that but I guess I got the syntax wrong... Is unsafeWindow the only way to do this? What's the security consequence of using it in this context? Thanks again! |
|
|
http://wiki.greasespot.net/UnsafeWindow good you ask, because I need to know too |
