Return to Snippet

Revision: 14608
at June 7, 2009 17:32 by abwaters


Initial Code
function setCookie() {
    var name = prompt('Name of the cookie');
    var value = prompt('Value of the cookie');
    var expires = prompt('Cookie expiration date');
    var path = prompt('Cookie path scope');
    var domain = prompt('Domain path scope');
    var secure = confirm('secure');
    var curCookie = name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
    document.cookie = curCookie;
    return curCookie;
}

Initial URL
http://www.arachna.com/edu/tutorials/mini/cookies/javascript.html

Initial Description

                                

Initial Title
Setting a Cookie in Javascript

Initial Tags

                                

Initial Language
JavaScript