I want to click my extension icon in the browser and have "test" appear in the console for the web page/tab i currently have selected in the browser.
manifest.json:
{
"name": "some name",
"version": "1.0",
"description": "some description",
"manifest_version": 2,
"permissions": ["storage", "tabs", "activeTab"],
"browser_action": {
"default_title": "hello!",
"default_popup": "popup.html",
"default_icon": "icon.png"
},
"background": {
"scripts": ["background.js"],
"persistent": true
}
}
background.js:
chrome.browserAction.onClicked.addListener(function(){
chrome.tabs.executeScript(null, {
code: "test"
})
I've used 'tabs' and 'activeTab' for permissions as i believe these are required for running this code.
If i click on the extension it doesn't show an error but it also doesn't show "test" in the console log for the web page i'm on.
Is there an obvious reason this isn't working from the code i've supplied?