2012-03-26 114 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。

相关问题