Search code examples
javascriptgoogle-chrome-extension

Chrome Extension Context Menu Item Not visible


I've followed some tutorials, but for some reason I'm not able to see the extension I added when I right-click.

manifest.json file

{
  "name": "name",
  "description": "description",
  "version": "1.0",
  "manifest_version": 3,
  "permissions": [
    "contextMenus"
  ],
  "background.service_worker": {
    "scripts": ["eventPage.js"],
    "persistent": false
  },
  "action": {
    "default_icon": "icon.png"
  },
   "icons": {
    "16" : "icon.png"
   }
}

eventPage.js file

var contextMenuItem = {
    "id": "id",
    "title": "title",
    "contexts": ["selection"]
}
chrome.contextMenus.create(contextMenuItem);

Solution

  • "manifest_version": 3,
    "background": {
        "service_worker": ""eventPage.js"
    }
    

    //OTHERWISE

    "manifest_version": 2,
    "background": {
        "persistent": false,
        "scripts": ["eventPage.js"]
    },