3

Chrome拡張機能を終了すると、エラーが見つかります。

 Uncaught TypeError: Cannot call method 'create' of undefined chrome-extension://dpfgkakomehcgdcnigflmkcfngeaamlc/js/background.js:46

injectScript startLiveReload init

私はこれを使用します

mainfest.json "background":{"scripts":["js / background.js"]}

とbackground.jsのような

var readMenuItemId = chrome.contextMenus.create({
  "title" : "阅读模式",
  "type" : "normal",
  contexts : [ "selection" ],
  documentUrlPatterns: ["http://*/*", "https://*/*"],
  "onclick" : genericOnClick
});

どこが悪いのかわからない

4

1 に答える 1

12

contextMenusこのオブジェクトを使用するには、マニフェスト ファイルにアクセス許可を追加する必要があります。

"permissions": [
    "contextMenus"
],
于 2012-08-28T03:15:31.583 に答える