Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function() {
var setCookie = function (cookieName, cookieValue, expirationInMinutes, domain) {
var expirationTime = expirationInMinutes * 60 * 1000;
var date = new Date();
var dateTimeNow = date.getTime();
date.setTime(dateTimeNow + expirationTime);
var expirationTime = date.toUTCString();
document.cookie = cookieName+"="+cookieValue+"; expires="+expirationTime+"; path=/; domain="+domain;
return setCookie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment