开发者

Chrome Bookmark Search

Can you get results from chome.bookmark.search without having to display them?

Update (Answer):

Ok. Maybe my problem is more complex. If I want to use the result globally.

 function _search() {
  var query = $("searchBox").value;
  chrome.bookmarks.search(query, function (bmk){
   var id = bmk[0].id;
   chrome.bookmarks.get(id, function (bmk){
    url=bmk[0].url;
   });
   chrome.tabs.getSelected(null, function (tab){
    chrome.tabs.update(tab.id, {url:开发者_如何学Go url});
    window.close();
   });
  });

This way I could use the list to open one of the results simply by calling

chrome.tabs.create({url:url})


Of course, read the docs:

chrome.bookmarks.search(string query, function callback)

use it this way:

chrome.bookmarks.search(query, function(results) {
   // iterate through results
   // open tabs or whatever
});

Updated: you can obviously copy the "results" into a global var but you can also "process in place".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜