I copy pasted the code below into my own extensionand was unable to get a console.log. I cloned the MDN sample extension repo and pasted the same code into an already existing event listener, and was unable to get a console.log response.
browser.browserAction.onClicked.addListener((tab) => {
// disable the active tab
browser.browserAction.disable(tab.id);
// requires the "tabs" or "activeTab" permission
console.log(tab.url);
});
Here is my manifest.json
"manifest_version": 2,
"name": "Translate",
"version": "1.0",
"description": "Google Translate for images, detects text and translates into desired output language.",
"browser_action": {
"default_icon": "icon.png",
"default_title": "Image Translate"
},
"permissions": ["activeTab"],
"background": {
"scripts": ["background.js"]
},
"icons": {
"48": "icon.png"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["translate.js"]
}
]
}