bookmarks

Interact with the browser's bookmarking system: bookmark pages, retrieve existing bookmarks, edit, remove, and organize bookmarks.

To use this API you need to have the "bookmarks" permission.

Types

bookmarks.BookmarkTreeNodeUnmodifiable
Indicates the reason that a bookmark or folder is unmodifiable.
bookmarks.BookmarkTreeNode
Represents a bookmark or a folder in the bookmarks tree.
bookmarks.CreateDetails
Object passed to the bookmarks.create() function.

Functions

bookmarks.get()
Retrieves the specified BookmarkTreeNode(s).
bookmarks.getChildren()
Retrieves the children of the specified BookmarkTreeNode.
bookmarks.getRecent()
Retrieves recently added bookmarks.
bookmarks.getTree()
Retrieves the entire bookmarks tree.
bookmarks.getSubTree()
Retrieves part of the bookmarks tree, starting at the specified node.
bookmarks.search()
Searches for BookmarkTreeNodes matching the given query.
bookmarks.create()
Creates a bookmark or folder under the specified parentId.
bookmarks.move()
Moves the specified BookmarkTreeNode to the provided location.
bookmarks.update()
Update the title or URL of a bookmark, or the name of a bookmark folder.
bookmarks.remove()
Removes a bookmark or an empty bookmark folder.
bookmarks.removeTree()
Recursively removes a bookmark folder.
bookmarks.import()
Imports bookmarks from an HTML bookmark file.
bookmarks.export()
Exports bookmarks to an HTML bookmark file.

Events

bookmarks.onCreated
Fired when a bookmark or folder is created.
bookmarks.onRemoved
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.
bookmarks.onChanged
Fired when a bookmark or folder changes. Currently, only title and url changes trigger this.
bookmarks.onMoved
Fired when a bookmark or folder is moved to a different parent folder.
bookmarks.onChildrenReordered
Fired when the user has sorted the children of a folder in the browser's UI. This is not called as a result of a move().
bookmarks.onImportBegan
Fired when a bookmark import session is begun. Expensive observers should ignore bookmarks.onCreated updates until bookmarks.onImportEnded is fired. Observers should still handle other notifications immediately.
bookmarks.onImportEnded
Fired when a bookmark import session has finished.

Browser compatibility

EdgeFirefoxChromeOpera
BookmarkTreeNode?45.0Yes33
BookmarkTreeNodeUnmodifiable?45.0Yes33
CreateDetails?45.0Yes33
create?45.0Yes33
export?NoYes33
get?45.0Yes33
getChildren?45.0Yes33
getRecent?47.0Yes33
getSubTree?45.0Yes33
getTree?45.0Yes33
import?NoYes33
move?45.0Yes33
onChanged?NoYes33
onChildrenReordered?NoYes33
onCreated?NoYes33
onImportBegan?NoYes33
onImportEnded?NoYes33
onMoved?NoYes33
onRemoved?NoYes33
remove?45.0Yes33
removeTree?47.0Yes33
search?47.0Yes33
update?45.0Yes33
Firefox
BookmarkTreeNodeNo
BookmarkTreeNodeUnmodifiableNo
CreateDetailsNo
createNo
exportNo
getNo
getChildrenNo
getRecentNo
getSubTreeNo
getTreeNo
importNo
moveNo
onChangedNo
onChildrenReorderedNo
onCreatedNo
onImportBeganNo
onImportEndedNo
onMovedNo
onRemovedNo
removeNo
removeTreeNo
searchNo
updateNo

Chrome incompatibilities

  • Firefox does not support:
    • import()
    • export()
    • onCreated
    • onRemoved
    • onChanged
    • onMoved
    • onChildrenReordered
    • onImportBegan
    • onImportEnded
    • BookmarkTreeNodeUnmodifiable
  • Firefox has special bookmarks like "Recently Bookmarked" or "Recently Visited"

Example add-ons

Acknowledgements

This API is based on Chromium's chrome.bookmarks API. This documentation is derived from bookmarks.json in the Chromium code.

Document Tags and Contributors

 Contributors to this page: wbamberg, evilpie
 Last updated by: wbamberg,