chrome.bookmarks.getRootByName

Contents

  1. Methods
    1. getRootByName

Methods

getRootByName

chrome.bookmarks.getRootByName(
	string id,
	function callback
)

Retrieves the specified bookmak root.

Parameters

id (String)

The ID of root bookmark item. Allowed values include bookmarks_barothermobileunsorteduser_rootsharedtrash, and speed_dial.

callback (function)

The callback function returns the root object. You can then iterate on this object to get its details and children.

Callback Function

The callback function returns the root object which is a BookmarkTreeNode object.

Example

chrome.bookmarks.getRootByName('bookmarks_bar', function(rootItem) {
	console.log(rootItem.title); // Will print 'Bookmarks Bar'
	chrome.bookmarks.getChildren(rootItem.id, function(result) {
		console.log(result[0].title); // Will print title of first entry in the bookmarks bar
	});
});