Skip to content

Instantly share code, notes, and snippets.

@fillerwriter
Created January 12, 2017 21:53
Show Gist options
  • Save fillerwriter/4b116e3c710f999cace82539389e1d8e to your computer and use it in GitHub Desktop.
Save fillerwriter/4b116e3c710f999cace82539389e1d8e to your computer and use it in GitHub Desktop.
var createCookie = function createCookie(name, value, days) {
var expires;
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
expires = "; expires="+date.toGMTString();
}
else {
expires = "";
}
document.cookie = name+"="+value+expires+"; path=/";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment