Fangxing
Fangxing

Reputation: 6105

How to access chrome.bookmarks in Chrome Console

I have read google's developer chrome.bookmarks doc and googled it, still can't find a way to access chrome.bookmarks in Chrome Console.

But I do can access chrome in Chrome Console

console.log(chrome) //run this in Chrome Console
// Object {app: Object, webstore: Object, runtime: Object, loadTimes: function, csi: function}

But try access chrome.bookmarks the same way, returned print undefined

console.log(chrome.bookmarks)

any suggestion?

Upvotes: 2

Views: 3130

Answers (1)

Makyen
Makyen

Reputation: 33296

There are multiple consoles for your extension. To access chrome.bookmarks from the console, you will need to be using a DevTools which is associated with a page in the background context (e.g. the background page, or popup, etc.). You will also need to have declared the bookmarks permission in your manifest.json.

Example of accessing chrome.bookmarks from the background page's DevTools:

Example of accessing <code>chrome.bookmarks</code>

Upvotes: 1

Related Questions