Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maximum LifeTime of javascript cookie

What can be the maximum acceptable expiry-time value of Javascript persistence cookie?

like image 360
Jeevi Avatar asked Apr 26 '12 06:04

Jeevi


1 Answers

Read : Expires and Max-Age of Cookies

Life time of the javascript cookies is depend on what amount of time you set when creating cookies for example following set the life time of 10 minutes

expiry = new Date();   
expiry.setTime(date.getTime()+(10*60*1000)); 
// Ten minutes   
 // Date()'s toGMTSting() method will format the date correctly for a cookie   
document.cookie = "visited=yes; expires=" + expiry.toGMTString(); 

there is no way that you can set the life time coookie...i.e cookie with no expiration

like image 92
Pranay Rana Avatar answered Sep 21 '22 09:09

Pranay Rana