【发布时间】:2018-01-11 05:05:34
【问题描述】:
我正在尝试使用 chrome.cookies.get 函数根据传递的域检索 cookie,但出现以下错误。有没有人遇到过同样的问题?请指教。
Actual CODE:
function getCookies(domain, name, callback) {
chrome.cookies.get({"url": domain, "name": name}, function(cookie) {
if(callback) {
callback(cookie.value);
}
});
}
ERROR:
index.js:167 Uncaught (in promise) TypeError: Cannot read property 'get' of undefined
at getCookies (index.js:167)
【问题讨论】:
-
谢谢@DashWinterson
-
@DashWinterson 当我查找 chrome 变量值时,我只看到这个,{loadTimes: ƒ, csi: ƒ, app: undefined, extension: undefined, i18n: undefined, ...} 我有什么遗漏吗?请指教。
标签: cookies google-chrome-extension