我正在尝试创建一个非常简单的 chrome 扩展,以便在单击时在新选项卡中打开硬编码链接,但我没有任何运气。添加扩展后,图标会显示出来,但是当我单击它时没有任何反应。有什么建议么?
清单.json
{
"name": "Drive Button",
"version": "1.0",
"manifest_version": 2,
"description": "Open Google Drive",
"browser_action": {
"default_icon": "icon.png"
},
"background": "background.html",
"permissions": [
"tabs"
]
}
背景.html
<html>
<head>
<script>
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function(tab) {
chrome.tabs.create({url: "http://drive.google.com"});
});
</script>
</head>
</html>