Skip to content

Instantly share code, notes, and snippets.

@justusbluemer
Created January 7, 2020 15:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save justusbluemer/81b6577fa5f663936d43cb06cdaf4166 to your computer and use it in GitHub Desktop.
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