ブラウザのアクションアイコンをクリックするとURLにリダイレクトされるChrome拡張機能を作成しています。
私が使おうとしているのは:
chrome.browserAction.onClicked.addListener
しかし、私は得る
Uncaught TypeError:未定義のプロパティ'onClicked'を読み取ることができません
これは私のマニフェストファイルです:
{
"name": "first extension",
"version": "2.2.12",
"description": "redirct to a link icon",
"browser_action": {
"default_icon": "icontest.png",
"default_title": "Do action"
},
"permissions": ["tabs", "http://*/*"],
"content_scripts": [{
"matches": ["http://*.twitter.com/*", "https://*.twitter.com/*"],
"js": ["twterland.js"]
}],
"icons": {
"16": "icontest.png",
"48": "icontest.png",
"128": "icontest.png"
}
}
これは私のjsファイルです:
chrome.browserAction.onClicked.addListener(function(tab) { alert("hi"); });