我尝试从特殊网站获取Cookie。
清单权限:
"permissions": [
"tabs",
"*//*free-way.me",
"storage",
"cookies"
],
这是我的popup.js:
function getCookies(domain, name)
{
chrome.cookies.get({"url": domain, "name": name}, function(cookie) {
return cookie.value;
});
}
var uid = getCookies("http://.free-way.me", "uid")
var upw = getCookies("http://.free-way.me", "upw")
document.getElementById("user").value = uid;
document.getElementById("pw").value = upw;
..但它告诉我,我没有权限:
cookies.get: No host permissions for cookies at url: "http://.free-way.me/".
at getCookies (chrome-extension://[...]/popup.js:19:24)
at chrome-extension://[...]/popup.js:25:13
请你告诉我,我犯了错误吗?......这让我感到很沮丧。谢谢!
马库斯
答案 0 :(得分:0)
您的match pattern格式错误。您在主机名中的星号后错过了一段时间:
"*//*.free-way.me"
如果主机标识符包含*
,则必须: