how can I override an anonymous javascript function attached to an eventlistener?

Posted by Sid on Stack Overflow See other posts from Stack Overflow or by Sid
Published on 2009-12-28T18:55:32Z Indexed on 2010/03/08 8:06 UTC
Read the original article Hit count: 303

I found that a website does somewhat sneaky things. When you hover over a link, it shows you the real URL. WHen you click on it, it uses the click/mousedown event to rewrite the URL.

I want to override that behaviour in firefox, So I fired up firebug to see what it does. On a mouse click, it executes a function called window.tgs. Easy, I thought. I can override this function.

My first attempt was to do get the element via getELementsByTagName(), and then

element.removeEventListener("click",window.tgs, false);

To my surprise, this did nothing.

I tried redefining window.tgs window.tgs = function() { return true; };

that did not do anything either.

I am not a JS expert. Your insights appreciated

thanks Sid

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about firefox