I am after some help with my javascript code. I am afraid I have no experience with JS, only html and css. I have a cookie policy notice on my website that I have installed from a friend. I am wondering if someone can tell me the expiration date I currently have in my code (as I have no clue).. Also if someone could recommend an expiration time for the EU Cookie Law policy if my code isn't appropriate already?
Code Below:
var euCookie = {
g: function(){
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1, c.length);
if (c.indexOf("euCookieLaw") == 0) return c.substring("euCookieLaw".length,c.length);
}
return null;
},
s: function(value){
var date = new Date();
date.setTime(date.getTime()+315532800000);
document.cookie = "euCookieLaw="+value+"; expires="+date.toGMTString()+"; path=/";
}
您的示例代码将cookie设置为从现在起过期315532800000毫秒,即,解析为3652天或距未来仅10年。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.