You can write a function like this:
function getCookie(cName) { var cVal = document.cookie.match('(?:^|;) ?' + cName + '=([^;]*)(?:;|$)'); if (!cVal) { return ""; } else { return cVal[1]; } }
Then, after you set the cookie, you can call getCookie() and check its return value, if it is an empty string, or "" which is false , then the cookie does not exist, otherwise you have a valid value cookie
The above paragraph in code:
var cookie = getCookie("users_resolution"); if (!cookie) {
source share