1. Home
  2. Javascript
  3. Set cookie for a year
#javascript#cookie

Set a cookie with one year expiry date.

document.cookie = `cookie_name=${cookie_value}; expires=${new Date(new Date().getTime()+1000*60*60*24*365).toGMTString()}; path=/`;
copy
Full Javascript cheatsheet
Sitemap Git repository