summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs/static/contextMenus.html
blob: e993372103dd4711baa5970801619e89d60bc86a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<div id="pageData-name" class="pageData">Context Menus</div>

<!-- BEGIN AUTHORED CONTENT -->
<p>
The context menus module allows you
to add items to Google Chrome's context menu.
</p>

<p>
You can choose what types of objects
your context menu additions apply to,
such as images, hyperlinks, and pages.
</P>

<p>
You can create as many context menu items
as you need, but if more than one
from your extension is visible at once,
Google Chrome automatically collapses them
into a single parent menu.
</p>

<p>
Context menu items can appear in any document
(or frame within a document),
even those with file:// or chrome:// URLs.
To control which documents your items can appear in,
specify the documentUrlPatterns field
when you call the create() or update() method.
</p>

<p class="note">
<strong>Version note:</strong>
Before Chrome 14, <!-- PENDING(asargent): fix version # -->
your items could appear only in documents with http://
or https:// URLs.
</p>

<h2 id="manifest">Manifest</h2>
<p>You must declare the "contextMenus" permission
in your extension's manifest to use the API.
Also, you should specify a 16x16-pixel icon
for display next to your menu item.
For example:
</p>

<pre>{
  "name": "My extension",
  ...
  "permissions": [
    <b>"contextMenus"</b>
  ],
  "icons": {
    <b>"16": "icon-bitty.png",</b>
    "48": "icon-small.png",
    "128": "icon-large.png"
  },
  ...
}</pre>

<h2 id="examples">Examples</h2>

<p>
You can find samples of this API on the
<a href="samples.html#contextMenus">sample page</a>.

<!-- END AUTHORED CONTENT -->