I know the answer for manifest v2: Add contextmenu items to a Chrome extension's browser action button
It's been working fine until migrating manifest from v2 to v3.
My current manifest.json
:
{
"manifest_version": 3,
"version": "0.1.1",
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "popup.html"
},
"content_scripts": [
{
"all_frames": false,
"matches": ["http://*/*", "https://*/*"],
"js": ["content.js"]
}
],
"permissions": ["contextMenus"],
...
}
And now this doesn't add a context menu item to my extension's browser action button:
chrome.contextMenus.create({
id: 'foo',
title: 'first',
contexts: ['browser_action'],
onclick: function () {
alert('first')
}
})
I checked that 'selection'
context properly adds a context menu to the selected text on a web page.
Is there something I have to do to migrate from v2 to v3?
onclick
function as an object within each contextMenus object). – Delora