1
Heyho, 我有一个函数来获取饼干和正常工作(除如果一部分中的getCookies()):检查 - Chrome扩展
function getCookies(domain, name, callback) {
chrome.cookies.get({"url": domain, "name": name}, function(cookie) {
if(callback) {
callback(cookie.value);
}
});
}
//USER ID
getCookies("http://free-way.me", "uid", function(id) {
if(id == null) { document.getElementById("submulti").disabled = true;}
else { document.getElementById("user").value = id;}
});
那么,当没有Cookie的控制台使我这个:
Error in response to cookies.get: TypeError: Cannot read property 'value' of null
at getCookies [...]
没有惊喜,但我不知道如何检查请求的工作,并返回错误禁用提交按钮。
这将是,如果你能帮助我不错..
谢谢 马库斯
谢谢,我会在星期五尝试它,但它看起来不错。谢谢你到目前为止 – wernersbacher
谢谢。作品完美 – wernersbacher