forked from openkylin/platform_build
remove cookie expiration and add max-age of 2 years.
bug: 17781603 Change-Id: Idab3cae786fde4d0318ba03d3c7f5f678882b815
This commit is contained in:
parent
963afcbb50
commit
f51f30d7f1
|
@ -900,16 +900,14 @@ function readCookie(cookie) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function writeCookie(cookie, val, section, expiration) {
|
function writeCookie(cookie, val, section, age) {
|
||||||
if (val==undefined) return;
|
if (val==undefined) return;
|
||||||
section = section == null ? "_" : "_"+section+"_";
|
section = section == null ? "_" : "_"+section+"_";
|
||||||
if (expiration == null) {
|
if (age == null) {
|
||||||
var date = new Date();
|
var age = 2*365*24*60*60; // set max-age to 2 years
|
||||||
date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
|
|
||||||
expiration = date.toGMTString();
|
|
||||||
}
|
}
|
||||||
var cookieValue = cookie_namespace + section + cookie + "=" + val
|
var cookieValue = cookie_namespace + section + cookie + "=" + val
|
||||||
+ "; expires=" + expiration+"; path=/";
|
+ "; max-age=" + age +"; path=/";
|
||||||
document.cookie = cookieValue;
|
document.cookie = cookieValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue