views:

161

answers:

3

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

A: 

Have you tried element.onclick = function(){}?

J-P
that does not work.. I think this is disabled for security reasons (I get a 'component is not available' error if I try to use it directly.thanksSid
Sid
A: 

Depending on how the function operates you could "in theory" manipulate the windows close event and attach your own handler.

While this is horribly inefficient it would get the job done.

Something like this possibly could work

window.onUnload(function(){

});
nwhiting
A: 

I did not really figure out how to fix this, so worked my way around it. I added another eventlistener which reversed everything that the function in question did. Lousy hack, but it works

Sid