Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chrome contextMenus API ContextType

I am looking at the API for chrome.contextMenu here.

The context types listed are:

  • "all"
  • "page"
  • "frame"
  • "selection"
  • "link"
  • "editable"
  • "image"
  • "video"
  • "audio"
  • "launcher"
  • "browser_action"
  • "page_action"

Some of these are intuitive, the others not so much.

Where can I find definitions for these different contexts? It is hard to make use of the api without this background knowledge.

Specifically, I would like to know "page", "frame", "editable", and "launcher".

like image 490
pqx994 Avatar asked Jul 12 '15 10:07

pqx994


People also ask

Where is the Chrome extension menu?

On your computer, open Chrome . At the top right, click Extensions .


1 Answers

  • "link", "image", "video", "audio" are more or less self-explanatory; they correspond to right-clicks on the appropriate HTML elements.
  • "editable" means a right-click in any text input element (when text is not selected, I think). It can be something obvious like <input>, <textarea> or any tag with content-editable enabled. This question may be of interest.
  • "page" means a right-click on any space on the page that is not covered by the above.
  • "all" is all of the above combined.
  • "frame" is like "all", but only for content within <iframe>s and not the parent document. (source & rationale)
  • "selection" means a right-click on a selected part of text/HTML; a text-only copy of the content will be passed to the callback, and a content script can be used to access the DOM of the selection.
  • "browser_action" and "page_action" populate your icon's context menu when using Browser Actions and/or Page Actions.
  • "launcher" only makes sense for Chrome Apps; it adds context menu entries to the App's shortcut in the App Launcher.
like image 99
Xan Avatar answered Oct 29 '22 22:10

Xan