2015/02/20

Chrome Extension Bookmarks API 取得書籤內容

要取得所有書籤內容可以使用chrome.bookmarks.getTree(function callback),利用function的results去取得所有書籤
而書籤又分為三種:

  1. 電腦版書籤
  2. 其他書籤
  3. 行動版書籤








Javascript:
$(function () {
 chrome.bookmarks.getTree(function (results) {
  var bookmarks = results[0].children;
  
 });
});

Manifest:
{
  "name": "C.Y. Fang",
  "manifest_version": 2,
  "version": "0.0.1",
  "description": "Happy new year",
  "homepage_url" : "http://cyfangnotepad.blogspot.tw/",
  "icons": { 
    "16" : "Images/book16.png",
    "128": "Images/book128.png"
  },
  "browser_action": {
    "default_title": "Title",
    "default_icon": "Images/book16.png"
  },
  "background": {
    "scripts": [
      "/Javascript/background.js"
    ]
  },
  "permissions": [
    "tabs",
    "bookmarks"
  ]
}