Reputation: 145
I have this piece of code in my background.js:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status == 'complete') {
chrome.tabs.executeScript(null, {code:"alert('Loaded');"});
}
});
This should give me an alert every time a page is loaded, but it doesn't..
Upvotes: 0
Views: 2258
Reputation: 13260
Check the tabs
permission on your manifest file. Also use the tabId on executeScript
:
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (changeInfo.status == 'complete') {
chrome.tabs.executeScript(tabId, {code:"alert('Loaded');"});
}
});
If this doesn't resolve your problem give me more details.
Upvotes: 2