Overload a javascript method with greasemonkey

Codewiz

Diamond Member
Jan 23, 2002
5,758
0
76
I am starting to feel pretty stupid now. I have written some very basic scripts that modifies html and urls using greasemonkey and javascript.

However, on one page I visit, there is a javascript method that I would like to modify. Basically it causes a flash popup to come up that I don't care for.

I would prefer to just overwrite the entire method with nothing in it.

 

kamper

Diamond Member
Mar 18, 2003
5,513
0
0
The term overloading means making a function with the same name but different parameters so you still have two distinct functions.

What you want to do is override (replace) but that's generally only applicable to methods within classes in an object oriented language and can't be applied to standalone functions.

I don't know if any browser actually supports this, but the solution that I can think of would involve accessing a list of functions (like you'd access a list of form elements or something), finding the one you want (kind of like a function pointer) and replacing it with a pointer to your own function.