1 <img src=
"{{static}}/images/bookmarks.png"
2 width=
"486" height=
"211" alt=
"Clicking the star adds a bookmark" />
4 <h2 id=
"manifest">Manifest
</h2>
5 <p>You must declare the
"bookmarks" permission
6 in the
<a href=
"manifest.html">extension manifest
</a>
7 to use the bookmarks API.
9 <pre data-filename=
"manifest.json">
11 "name":
"My extension",
20 <h2 id=
"description">Objects and properties
</h2>
23 Bookmarks are organized in a tree,
24 where each node in the tree
25 is either a bookmark or a folder
26 (sometimes called a
<em>group
</em>).
29 $ref:bookmarks.BookmarkTreeNode object.
33 <code>BookmarkTreeNode
</code> properties
34 are used throughout the
<code>chrome.bookmarks
</code> API.
35 For example, when you call
36 $ref:bookmarks.create,
37 you pass in the new node's parent (
<code>parentId
</code>),
38 and, optionally, the node's
39 <code>index
</code>,
<code>title
</code>, and
<code>url
</code> properties.
40 See $ref:bookmarks.BookmarkTreeNode
41 for information about the properties a node can have.
44 <p class=
"note"><b>Note:
</b> You cannot use this API to add or remove entries
45 in the root folder. You also cannot rename, move, or remove the special
46 "Bookmarks Bar" and
"Other Bookmarks" folders.
</p>
48 <h2 id=
"overview-examples">Examples
</h2>
51 The following code creates a folder with the title
"Extension bookmarks".
52 The first argument to
<code>create()
</code> specifies properties
54 The second argument defines a function
55 to be executed after the folder is created.
59 chrome.bookmarks.create({'parentId': bookmarkBar.id,
60 'title': 'Extension bookmarks'},
62 console.log(
"added folder: " + newFolder.title);
67 The next snippet creates a bookmark pointing to
68 the developer documentation for extensions.
69 Since nothing bad will happen if creating the bookmark fails,
70 this code doesn't bother to define a callback function.
74 chrome.bookmarks.create({'parentId': extensionsFolderId,
75 'title': 'Extensions doc',
76 'url': 'http://code.google.com/chrome/extensions'});
80 For an example of using this API, see the
81 <a href=
"http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/bookmarks/basic/">basic bookmarks sample
</a>.
82 For other examples and for help in viewing the source code, see
83 <a href=
"samples.html">Samples
</a>.