Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开发一个谷歌浏览器扩展。但是当我添加这个以获得最后访问的网站时,
chrome.history.search({ 'text': '', 'startTime': closedTime, 'maxResults': 1 }, function (historyItems) { //do stuff } );
它会导致此错误:
未捕获的类型错误:无法调用未定义的方法“搜索”
我的咒语是对的,但我不知道发生了什么?我能做些什么来解决这个错误?
在使用 API 之前,您必须通过清单文件请求使用它的权限:
{ ... "permissions": [ "history" ], ... }
(这也在的文档中chrome.history提到)。
chrome.history