0
通過以下代碼,我嘗試在用戶點擊Chrome擴展程序圖標時在標籤中打開mailto:
鏈接。但是,一旦點擊圖標,就不會執行任何操作。如何通過點擊Chrome擴展程序圖標打開郵件鏈接?
manifest.json的
{
"manifest_version": 2,
"name": "Extension",
"description": "Description",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png"
},
"permissions": [
"tabs"
]
}
popup.js
chrome.browserAction.onClicked.addListener(function tab) {
var emailUrl = "mailto:[email protected]";
chrome.tabs.create({ url: emailUrl });
};