Intercept the mouse on href from the Firefox extension


How can I know the url under the mouse cursor from a firefox extension?

I need to interact with the href from within the overlay.js file.

I'd want a lightweight solution, for example I don't want to attach some event to all hrefs found in a page.

I'd rate a mouseover solution but how can't find anything useful for me!


You could use event delegation and attach single event listener to the document.body element, instead of all hrefs on the page. Then you need to check if the element which triggered your listener is a link or not. Here's a simple example that demonstrates the idea:

document.body.addEventListener( 'mouseover',
        if('A'){ alert( ) }
    }, false);