0
我正在學習如何進行擴展,現在我所做的只是在點擊按鈕時從選項卡獲取url,但我得到以下錯誤沒有權限使用tabs.getSelected
Uncaught Error: You do not have permission to use 'tabs.getSelected'. Be sure to declare in your manifest what permissions you need.
這裏是我的清單
{
"name": "test",
"version": "0.1",
"description": "share a link",
"browser_action": {
"default_icon": "icon.png",
"default_title": "test",
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
],
"popup": "popup.html"
}
}
和我跑
$(document).ready(function(){
function myFunction(tablink) {
alert(tablink);
}
$("#send").click(function()
{
console.log("tablink");
chrome.tabs.getSelected(null, function(tab) {
myFunction(tab.url);
});
});
});
任何建議代碼放在我錯過了我?