Hi, I am just learning so I created this very basic plugin.
When you right-click on a tab, it has a new item called “Prompt for Name” which is supposed to call a simple prompt. I loaded the plugin in about:debugging and ran it. The menu item comes up when I right click the tab, but nothing happens when I click on it. Here is the code:
Manifest:
{
“manifest_version”: 2,
“name”: “Page Title Changer”,
“version”: “1.0”,
"description": "Prompts the user to change the page title when they right-click on the page.",
"permissions": [
"contextMenus",
"tabs"
],
"background": {
"scripts": ["background.js"]
}
}
background.js
function promptForName(info, tab) {
let name = prompt(“Please enter your name:”);
// do something with the user’s name
}
browser.contextMenus.create({
id: “prompt-for-name”,
title: “Prompt for Name”,
contexts: [“tab”]
});
browser.contextMenus.onClicked.addListener(promptForName);