[英]Chrome extension: "No permission for cookies at url"
我嘗試從一個特殊的網站獲取 Cookies。
清單權限:
"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
你能告訴我我犯的錯誤嗎?......它讓我瘋狂。 謝謝你!
馬庫斯
Manifest 版本 3 對主機權限進行了一些更改。在 MV3 中,您需要將主機權限與其他權限分開指定:
// Manifest V2
"permissions": [
"tabs",
"bookmarks",
"http://www.blogger.com/",
],
"optional_permissions": [
"*://*/*",
"unlimitedStorage"
]
// Manifest V3
"permissions": [
"tabs",
"bookmarks"
],
"optional_permissions": [
"unlimitedStorage"
],
"host_permissions": [
"http://www.blogger.com/",
"*://*/*"
],
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.