> For the complete documentation index, see [llms.txt](https://openai.gitbook.io/code-cheatsheets/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://openai.gitbook.io/code-cheatsheets/js/all/chrome_plugins/context_menu.md).

# Context Menu

Can add stuff to the right click menu

Need `"contextMenus"` permission in the manifest

background.js

```javascript
function searchUrbanDict(word) {
  debug("TESTING STUFF");
};

browser.contextMenus.create({
  title: "Search in UrbanDictionary",
  contexts: ["selection"], // ContextType
  onclick: searchUrbanDict, // A callback function
});
```

## ContextTypes

`"all"`, `"page"`, `"frame"`, `"selection"`, `"link"`, `"editable"`, `"image"`, `"video"`, `"audio"`, `"launcher"`, `"browser_action"`, or `"page_action"`

## ItemTypes

`"normal"`, `"checkbox"`, `"radio"`, or `"separator"`
