Chrome API (chrome.topSites.get) 在浏览器启动期间尚未准备就绪



有没有人遇到浏览器启动期间chrome API不可用的情况

我只在一台测试计算机上启动浏览器期间才在日志中遇到"回调发生"的情况

chrome.topSites.get(function(data) { console.log("回调发生");});

在权限选项卡中添加topSites

manifest.json

"permissions": [
    "tabs",
    "activeTab", 
    "topSites", << Add this 
    "http://*/*",
    "https://*/*"
],
 "browser_action": {
   "default_popup": "popup.html"
}

并在弹出窗口中.html添加 js 文件并写入

chrome.topSites.get(function(t) { console.log('Here I am inside topSites')});

它在我这边工作。

最新更新