I want to deploy content scripts only into sites that a user wants to deploy them to. I have this list of sites, and I want to deploy some script.js only to these sites.
Something like this (in a background page):
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
});
}
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.