Reputation: 556
I am adding this listener in background.js file which is a background script
chrome.tabs.onActivated.addListener( function(info) {
chrome.tabs.get(info.tabId, function(tab) {
chrome.tabs.reload();
});
});
But in the chrome object tabs are not there.
The manifest file is
{
"name": "Tab Logger",
"description": "Logs the clicked tabs with time",
"version": "0.1",
"manifest_version": 2,
"app": {
"background": {
"scripts": ["background.js"]
}
},
"permissions": [
"tabs"
],
"icons": { "16": "calculator-16.png", "128": "calculator-128.png" }
}
Can anybody tell me what am I doing wrong?
Upvotes: 0
Views: 90
Reputation: 77523
chrome.tabs
API is not listed as supported for Apps, and your manifest is for an app and not an extension.
You will need to either make an extension, or not use tabs
API.
To convert your manifest to an extension simply change
"app": {
"background": {
"scripts": ["background.js"]
}
},
into
"background": {
"scripts": ["background.js"]
},
Upvotes: 1