manifest.json
代碼如下:
{
"name": "我的右鍵",
"description": "chrome擴(kuò)展學(xué)習(xí)---menu使用",
"version": "0.1",
"permissions": ["contextMenus", "tabs"],
"background": {
"scripts": ["menu.js"]
},
"manifest_version": 2
}
menu.js
代碼如下:
function genericOnClick(info, tab) {
alert(info.linkUrl);
}
function selectionOnClick(info, tab) {
alert(info.selectionText);
}
var link = chrome.contextMenus.create({"title": "鏈接地址","contexts":["link"],"onclick":genericOnClick});
更多信息請(qǐng)查看IT技術(shù)專欄