HTTP cookie function setCookie(key,value,day) { let date=new Date(); date.setTime(date.getTime()+(1000*60*60*24*day)); document.cookie=key+'='+value+'; '+'expires='+date.toGMTString(); } function getCookie(key) { let cookies=document.cookie.split(';'); for(let n=0; n<cookies.length; n++){ let cookie=cookies[n].trim(); if(cookie.indexOf(key+'=')==0) return cookie.substring(key.length+1,cookie.length); } return ''; }