bookmarks.search()

Searches for bookmarks matching the given query. Matching bookmarks are returned as bookmarks.BookmarkTreeNode objects.

Syntax

browser.bookmarks.search(
  query,                  // string or object
  function(results) {...} // function
)

Parameters

query
string or object. Either a string or an object.
If query is a string, it consists of zero or more search terms. Search terms are space-delimited or may be quoted if the search term itself needs to include a space. Each search term matches if it matches any substring in the bookmark's URL or title. Matching is case-insensitive.

For a bookmark to match the query, all the query's search terms must match.

If query is an object, it has zero or more of the following 3 properties: query, title, url, which are described below. For a bookmark to match the query, all provided properties terms must match.

queryOptional
string. This matches in the same way as the string form of query.
urlOptional
string. This must exactly match the bookmark's url. Matching is case-insensitive, and trailing slashes are ignored.

If you pass an invalid URL here, the function will throw an error.

titleOptional
string. This must exactly match the bookmark's title. Matching is case-sensitive.
callback
function. The function is passed the following arguments:
results
array of bookmarks.BookmarkTreeNode.

Browser compatibility

EdgeFirefoxChromeOpera
Basic support?47.0Yes33
Firefox
Basic supportNo

Examples

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, johannh
 Last updated by: wbamberg,