2012-03-26 112 views

回答

2

chrome.tabs.onUpdated.addListener可用於檢測tab負載。這不會框架內檢測導航雖然:

chrome.tabs.onUpdated.addListener(function(tabId, info, tab) { 
    if (info.status === 'complete' && /some_reg_ex_pattern/.test(tab.url)) { 
     // ... 
    } 
}); 

爲此,你最好使用內容腳本,與all_frames set to true。在內容腳本中,您可以使用this answer中所述的方法注入代碼。然後使用該頁面的location對象來過濾URL。

相關問題