开发者

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 ne开发者_运维技巧ver 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜