2011-02-09 70 views

回答

5

像這樣的東西(在後臺頁面):

chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { 
    if(changeInfo.status == "complete" && isInUserList(tab.url)) { 
     chrome.tabs.executeScript(tabId, {file:"script.js"}, function() { 
      //script injected 
     }); 
    } 
}); 
+0

請注意,您所需要的[`tabs`(https://developer.chrome.com/extensions/tabs)權限,以便能夠訪問`tab.url`。 – 2015-09-03 08:14:54