Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code samples are licensed under the BSD License.
?2013 Google
このページは大阪弁化フィルタによって翻訳生成されたんですわ。 |
Description: |
Use the chrome.bookmarks API to create, organize, and otherwise manipulate bookmarks. Also see Override Pages, which you can use to create a custom Bookmark Manager page.
|
Availability: |
Stable since Chrome 5.
|
Permissions: |
"bookmarks"
|
You must declare the "bookmarks" permission in the extension manifest to use the bookmarks API. For example:
{ "name": "My extension", ... "permissions": [ "bookmarks" ], ... }
Bookmarks are organized in a tree, where each node in the tree is either a bookmark or a folder (sometimes called a group). Each node in the tree is represented by a BookmarkTreeNode object.
BookmarkTreeNode
properties
are used throughout the chrome.bookmarks
API.
For example, when you call
create,
you pass in the new node's parent (parentId
),
and, optionally, the node's
index
, title
, and url
properties.
See BookmarkTreeNode
for information about the properties a node can have.
Note: You cannot use this API to add or remove entries in the root folder. You also cannot rename, move, or remove the special "Bookmarks Bar" and "Other Bookmarks" folders.
The following code creates a folder with the title "Extension bookmarks".
The first argument to create()
specifies properties
for the new folder.
The second argument defines a function
to be executed after the folder is created.
chrome.bookmarks.create({'parentId': bookmarkBar.id, 'title': 'Extension bookmarks'}, function(newFolder) { console.log("added folder: " + newFolder.title); });
The next snippet creates a bookmark pointing to the developer documentation for extensions. Since nothing bad will happen if creating the bookmark fails, this code doesn't bother to define a callback function.
chrome.bookmarks.create({'parentId': extensionsFolderId, 'title': 'Extensions doc', 'url': 'http://code.google.com/chrome/extensions'});
For an example of using this API, see the basic bookmarks sample. For other examples and for help in viewing the source code, see Samples.
move
, update
, create
, or remove
operations that can be performed each hour. Updates that would cause this limit to be exceeded fail.
move
, update
, create
, or remove
operations that can be performed each minute, sustained over 10 minutes. Updates that would cause this limit to be exceeded fail.
Retrieves the specified BookmarkTreeNode(s).
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Retrieves the children of the specified BookmarkTreeNode id.
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Retrieves the recently added bookmarks.
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Retrieves the entire Bookmarks hierarchy.
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Retrieves part of the Bookmarks hierarchy, starting at the specified node.
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Searches for BookmarkTreeNodes matching the given query.
The callback parameter should specify a function that looks like this:
function(array of BookmarkTreeNode results) {...};
Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.
If you specify the callback parameter, it should specify a function that looks like this:
function(BookmarkTreeNode result) {...};
Moves the specified BookmarkTreeNode to the provided location.
If you specify the callback parameter, it should specify a function that looks like this:
function(BookmarkTreeNode result) {...};
Updates the properties of a bookmark or folder. Specify only the properties that you want to change; unspecified properties will be left unchanged. Note: Currently, only 'title' and 'url' are supported.
If you specify the callback parameter, it should specify a function that looks like this:
function(BookmarkTreeNode result) {...};
Fired when a bookmark or folder is created.
The callback parameter should specify a function that looks like this:
function(string id, BookmarkTreeNode bookmark) {...};
Fired when a bookmark or folder is removed. When a folder is removed recursively, a single notification is fired for the folder, and none for its contents.
Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this.
Fired when a bookmark or folder is moved to a different parent folder.
Fired when the children of a folder have changed their order due to the order being sorted in the UI. This is not called as a result of a move().
Fired when a bookmark import session is begun. Expensive observers should ignore onCreated updates until onImportEnded is fired. Observers should still handle other notifications immediately.