Heyho, I got a function to get cookies and it works fine (except the if-part in getCookies()):
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;}
});
Well, when there's no cookie the console gives me this:
Error in response to cookies.get: TypeError: Cannot read property 'value' of null
at getCookies [...]
No surprise, but I don't know how to check if the the request worked, and return the error to disable the submit-button.
It would be nice if you could help me..
Thank you, Markus