Chrome extension code vs Content scripts vs Injected scripts
问题 I am trying to get my Chrome Extension to run the function init() whenever a new page is loaded, but I am having trouble trying to understand how to do this. From what I understand, I need to do the following in background.html: Use chrome.tabs.onUpdated.addListener() to check when the page is changed Use chrome.tabs.executeScript to run a script. This is the code I have: //background.html chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { chrome.tabs.executeScript(null,