0

我无法在 Chromium 版本 25.0.1364.160 Ubuntu 12.10 (25.0.1364.160-0ubuntu0.12.10.1) 上使用 chrome.webRequest。尝试访问其方法时出现未定义的错误。它甚至不会加载到 chrome 命名空间中。这是我的代码和配置:

清单.json:

{
  "manifest_version": 2,
  "name": "My Extension",
  "description": "....",
  "version": "0.9",
  "browser_action": {
    "default_icon": "icon.png",
    "default_popup": "index.html"
  },
  "permissions": [
    "experimental",
    "webRequest",
    "webRequestBlocking",
    "<all_urls>"
  ],
  "background": {
    "scripts": ["index.js"],
    "persistent": true
  }
}

index.js:

console.log(chrome,'chrome');

输出:

Object
Event: function (opt_eventName, opt_argSchemas, opt_eventOptions) {
app: Object
appNotifications: Object
bookmarks: Object
browserAction: Object
commands: Object
csi: function () { native function GetCSI(); return GetCSI();}
devtools: Object
extension: Object
i18n: Object
infobars: Object
loadTimes: function () { native function GetLoadTimes(); return GetLoadTimes();}
management: Object
omnibox: Object
pageAction: Object
permissions: Object
runtime: Object
scriptBadge: Object
searchBox: Object
tabs: Object
test: Object
tld: Object
types: Object
windows: Object
__proto__: Object
4

1 回答 1

-2

进入 chrome://flags/ 并启用 Experimental Extension APIs。重新启动浏览器。

于 2013-06-10T20:27:11.053 回答