I have an addon that is meant to just print out “hi!” when a link is right-clicked (and the menu optional is clicked). However for some reason it seems to not print anything, both in the Browser Console, and the actual tab’s console (Ctrl + Shift + I)
// manifest.json
{
"manifest_version": 2,
"name": "hello-world",
"version": "1.0.0",
"description": "The addon that does jack sh*t!",
"permissions": [
"contextMenus"
],
"background": {
"scripts": [
"./background.js"
]
},
"content_scripts": [
{
"matches": [
"<all_urls>"
]
}
]
}
// background.js
const MENU_ID = 'thing-e-roo';
browser.contextMenus.create({
id: MENU_ID,
title: 'Perform a useless console log',
contexts: ['link']
})
browser.contextMenus.onClicked.addListener((info, tab) => {
if (info.menuItemId === MENU_ID) {
console.log('hi!')
}
})
This is the code, and it’s meant to just print “hi!” when the option is clicked. I’ve tried it without the condition, tried using alert
instead and still seems to not do anything, so I’m kind of unsure what to do at this point
Thanks!