Code has been added to clipboard!

Checking JavaScript Cookies

Example
function checkCookie() {
    var firstname = getCookie("firstname");
    if (firstname != "") {
        alert("Welcome again " + firstname);
    } else {
        firstname = prompt("Enter name:", "");
        if (firstname != "" && firstname != null) {
            setCookie("firstname", firstname, 365);
        }
    }
}