Use the browser.bookmarks API to create, organize, and otherwise manipulate bookmarks. Also see Override Pages, which you can use to create a custom Bookmark Manager page.

Permissions: bookmarks

Not allowed in: Content scripts, Devtools pages

_MoveDestination
_OnChangedChangeInfo
_OnChildrenReorderedReorderInfo
_OnMovedMoveInfo
_OnRemovedRemoveInfo
_UpdateChanges
BookmarkTreeNode
CreateDetails
BookmarkTreeNodeType
BookmarkTreeNodeUnmodifiable
onChanged
onChildrenReordered
onCreated
onMoved
onRemoved
create
get
getChildren
getRecent
getSubTree
getTree
move
remove
removeTree
search
update
BookmarkTreeNodeType: "bookmark" | "folder" | "separator"

Indicates the type of a BookmarkTreeNode, which can be one of bookmark, folder or separator.

BookmarkTreeNodeUnmodifiable: "managed"

Indicates the reason why this node is unmodifiable. The managed value indicates that this node was configured by the system administrator or by the custodian of a supervised user. Omitted if the node can be modified by the user and the extension (default).

onChanged: WebExtEvent<
    (id: string, changeInfo: browser.bookmarks._OnChangedChangeInfo) => void,
>

Fired when a bookmark or folder changes. Note: Currently, only title and url changes trigger this.

onChildrenReordered:
    | WebExtEvent<
        (id: string, reorderInfo: _OnChildrenReorderedReorderInfo) => void,
    >
    | undefined

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().

Unsupported on Firefox at this time.

onCreated: WebExtEvent<(id: string, bookmark: BookmarkTreeNode) => void>

Fired when a bookmark or folder is created.

onMoved: WebExtEvent<
    (id: string, moveInfo: browser.bookmarks._OnMovedMoveInfo) => void,
>

Fired when a bookmark or folder is moved to a different parent folder.

onRemoved: WebExtEvent<
    (id: string, removeInfo: browser.bookmarks._OnRemovedRemoveInfo) => void,
>

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.

  • Creates a bookmark or folder under the specified parentId. If url is NULL or missing, it will be a folder.

    Parameters

    Returns Promise<BookmarkTreeNode>

  • Retrieves the specified BookmarkTreeNode(s).

    Parameters

    • idOrIdList: string | string[]

      A single string-valued id, or an array of string-valued ids

    Returns Promise<BookmarkTreeNode[]>

  • Retrieves the children of the specified BookmarkTreeNode id.

    Parameters

    • id: string

    Returns Promise<BookmarkTreeNode[]>

  • Retrieves the recently added bookmarks.

    Parameters

    • numberOfItems: number

      The maximum number of items to return.

    Returns Promise<BookmarkTreeNode[]>

  • Retrieves part of the Bookmarks hierarchy, starting at the specified node.

    Parameters

    • id: string

      The ID of the root of the subtree to retrieve.

    Returns Promise<BookmarkTreeNode[]>

  • Retrieves the entire Bookmarks hierarchy.

    Returns Promise<BookmarkTreeNode[]>

  • Removes a bookmark or an empty bookmark folder.

    Parameters

    • id: string

    Returns Promise<void>

  • Recursively removes a bookmark folder.

    Parameters

    • id: string

    Returns Promise<void>

  • Searches for BookmarkTreeNodes matching the given query. Queries specified with an object produce BookmarkTreeNodes matching all specified properties.

    Parameters

    • query: string | { query?: string; title?: string; url?: string }

      Either a string of words that are matched against bookmark URLs and titles, or an object. If an object, the properties query, url, and title may be specified and bookmarks matching all specified properties will be produced.

      • string
      • { query?: string; title?: string; url?: string }
        • Optionalquery?: string

          A string of words that are matched against bookmark URLs and titles.

        • Optionaltitle?: string

          The title of the bookmark; matches verbatim.

        • Optionalurl?: string

          The URL of the bookmark; matches verbatim. Note that folders have no URL.

    Returns Promise<BookmarkTreeNode[]>

  • 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.

    Parameters

    Returns Promise<BookmarkTreeNode>