【问题标题】:"Cannot read property 'search' of undefined" - chrome.history.search“无法读取未定义的属性‘搜索’” - chrome.history.search
【发布时间】:2017-02-25 16:13:23
【问题描述】:

我尝试使用 chrome 历史 API。

使用“chrome.history.search”时出错

无法读取未定义的属性“搜索”

chrome.history.search({
      'text': ''  
    },
    function(historyItems) {
// My TODO
});

有什么办法,怎么解决?

【问题讨论】:

标签: javascript google-chrome


【解决方案1】:

不清楚之前的答案是否正确。如果没有,请尝试将'history' 添加到manifest.json 中的permissions 数组中。

【讨论】:

    【解决方案2】:

    如果您在 API 不可用的上下文中运行代码,则会发生此错误。该 API 仅适用于扩展程序的页面(如背景视图),而不适用于常规网站。

    【讨论】:

      【解决方案3】:

      向权限添加“历史记录”对我有用。并且不需要扩展页面。它适用于常规 .js

      【讨论】:

        猜你喜欢
        • 2014-01-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-05-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多