Search code examples
firefoxmobileclickinterceptfennec

Mobile firefox click interception


I'm trying to intercept a click on a link (e.g. LINK) in the mobile version of Firefox aka Fennec.

My current looks something like this:

var appcontent = document.getElementById("appcontent"); // Firefox
if (!appcontent) {
    appcontent = event.currentTarget; // Fennec
}

appcontent.addEventListener("click", function(event) {      

    if(event.target.tagName.toLowerCase() == "a"){
        alert("click detected" + );
    }
 }, true);

Apparently the event.target.tagName never contains the a tag, but other tags like notificationbox and button. I need this to differentiate javascript buttons from clicks.

Anyone knows what i'm doing wrong?


Solution

  • Are you trying to catch links on things in the web page this way?

    In Fennec, the web page runs in a separate process, so a click event you see in chrome can't be targeted at a web page node; there's simply no such object in the chrome process.

    If you're trying to catch web page interaction, see https://wiki.mozilla.org/Content_Process_Event_Handlers