java set cookie never expire

So, there is no block of code you can write in JavaScript to set up a cookie that never expires. document.cookie = "cookiename=cookievalue" You can even add expiry date to your cookie so that the particular cookie will be removed from the computer on the specified date. getMaxAge() – returns the maximum age in seconds. How to set the default value for an HTML