Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

bookmarks.move()

The bookmarks.move() method moves the specified BookmarkTreeNode to the specified destination within the tree of bookmarks. This lets you move a bookmark to a new folder and/or position within the folder.

Syntax

chrome.bookmarks.move(
  id,                    // string
  destination,           // object
  function(              // optional function
    result                 // BookmarkTreeNode object
  ) {...}
)

This API is also available as browser.bookmarks.move() in a version that returns a promise.

Parameters

id
A string containing the ID of the bookmark or folder to move.
destination
An object which specifies the destination for the bookmark. This object must contain one or both of the following fields:
parentId Optional
A string which specifies the ID of the destination folder. If this value is left out, the bookmark is moved to a new location within its current folder.
index Optional
A 0-based index specifying the position within the folder to which to move the bookmark. A value of 0 moves the bookmark to the top of the folder. If this value is omitted, the bookmark is placed at the end of the new parent folder.
callback Optional
A function which is called once the move operation is completed. It receives as input one parameter:
result
The updated BookmarkTreeNode describing the moved node.

Browser compatibility

Chrome Edge Firefox Firefox for Android Opera
Basic support Yes No 45.0 No 33

Examples

Move a bookmark to the top of its folder

This example moves an existing bookmark so that it's the first bookmark in its current folder. It does so without using a callback, since it takes no further action.

chrome.bookmarks.move(bookmarkID, { index: 0 });

Move a bookmark to a different folder

This example shows how to write a function which, given a bookmark's ID and a folder ID, moves the bookmark into that folder. It also provides a callback which is run when the move is completed.

function moveToFolder(bookmarkId, destinationId) {
  chrome.bookmarks.move(bookmarkId, { parentId: destinationId },
                         function(updatedNode) {
    /* The bookmark has been moved */
  });
}

Acknowledgements

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

Microsoft Edge compatibility data is supplied by Microsoft Corporation and is included here under the Creative Commons Attribution 3.0 United States License.

Document Tags and Contributors

 Contributors to this page: Makyen, Sheppy, wbamberg
 Last updated by: Makyen,