//define cookieAction to manage all the actions for cookie on client //current Unix timestamp : Math.round(new Date().getTime()/1000) //getTime()返回数值的单位是毫秒 //For PRC, using GMT->UTC not accurate
/** * [getCookie get the cookie in browser, if it's still available] * @param {[type]} c_name [description] * @return {[type]} [description] */ getCookie: function(c_name) { if (document.cookie.length > 0) { c_start = document.cookie.indexOf(c_name + "="); if (c_start != -1) { c_start = c_start + c_name.length + 1; c_end = document.cookie.indexOf(";", c_start); if (c_end == -1) c_end = document.cookie.length; returnunescape(document.cookie.substring(c_start, c_end)); } } return"";
},
//how to check cookie is available or if it is expired? //if the cookie exist, there must be could using getCookie Fn to get the value, if it expired, it wouldn't get it.