2011-04-25 118 views
0

我試圖攔截點擊一個鏈接(例如LINK)在Firefox的又名Fennec的移動版本。手機firefox點擊攔截

我現在看起來是這樣的:

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); 

顯然,event.target.tagName從未包含一個標籤,但其他標籤,如notificationbox和按鈕。我需要這個來區分javascript按鈕和點擊。

任何人都知道我在做什麼錯?

回答

0

您是否試圖以這種方式捕捉網頁中的事物鏈接?

在Fennec中,網頁在單獨的進程中運行,因此您在Chrome中看到的點擊事件不能針對網頁節點;在鍍鉻過程中根本沒有這樣的對象。

如果你想趕上網頁交互,看到https://wiki.mozilla.org/Content_Process_Event_Handlers