OSDN Git Service

remove cookie expiration and add max-age of 2 years.
authorsmain@google.com <smain@google.com>
Mon, 3 Nov 2014 18:47:12 +0000 (10:47 -0800)
committersmain@google.com <smain@google.com>
Mon, 3 Nov 2014 19:39:00 +0000 (11:39 -0800)
bug: 17781603

Change-Id: Idab3cae786fde4d0318ba03d3c7f5f678882b815

tools/droiddoc/templates-sdk/assets/js/docs.js

index d3f815a..8daef7f 100644 (file)
@@ -900,16 +900,14 @@ function readCookie(cookie) {
   return 0;
 }
 
-function writeCookie(cookie, val, section, expiration) {
+function writeCookie(cookie, val, section, age) {
   if (val==undefined) return;
   section = section == null ? "_" : "_"+section+"_";
-  if (expiration == null) {
-    var date = new Date();
-    date.setTime(date.getTime()+(10*365*24*60*60*1000)); // default expiration is one week
-    expiration = date.toGMTString();
+  if (age == null) {
+    var age = 2*365*24*60*60; // set max-age to 2 years
   }
   var cookieValue = cookie_namespace + section + cookie + "=" + val
-                    + "; expires=" + expiration+"; path=/";
+                    + "; max-age=" + age +"; path=/";
   document.cookie = cookieValue;
 }