Is there any way to set an expiration time for a local shared object as you can with a cookie?
Thanks.
Printable View
Is there any way to set an expiration time for a local shared object as you can with a cookie?
Thanks.
You could do:
code:
var d;
var mySO = SharedObject.getLocal("expTest", "/");
if ( !mySO.data.expirationDate) {
var daysTillExpiration = 5;
d = new Date();
d.setDate(d.getDate() + daysTillExpiration);
mySO.data.expirationDate = d;
}
d = new Date();
trace("current : " + d);
trace("expires : " + mySO.data.expirationDate);
if (mySO.data.expirationDate < d) {
trace( "expired" );
} else {
trace( "still valid");
}