jquery设置cookie过期时间与检查cookies是否可用
jquery设置cookie过期时间与检查cookies是否可用
让cookies在x分钟后过期
var date = new date();
datesettime(dategettime() + (x * * ));
$cookie(‘example ‘foo { expires: date });
检查cookies是否可用
$(document)ready(function() {var dt = new date();dtsetseconds(dtgetseconds() + );documentcookie = “cookietest=; expires=” + dttogmtstring();var cookiesenabled = documentcookieindexof(“cookietest=”) != ;if(!cookiesenabled){//cookies不能用……}});