Cookie 判断页面是否为第一次打开 包括刷新

$.cookie = function(e, t, n) {
if(arguments.length > 1 && (!/Object/.test(Object.prototype.toString.call(t)) || t === null || t === undefined)) {
n = $.extend({}, n);
if(t === null || t === undefined) {
n.expires = -1
}
if(typeof n.expires === "number") {
var r = n.expires,
i = n.expires = new Date;
i.setDate(i.getDate() + r)
}
t = String(t);
return document.cookie = [encodeURIComponent(e), "=", n.raw ? t : encodeURIComponent(t), n.expires ? "; expires=" + n.expires.toUTCString() : "", n.path ? "; path=" + n.path : "", n.domain ? "; domain=" + n.domain : "", n.secure ? "; secure" : ""].join("")
}
n = t || {};
var s = n.raw ? function(e) {
return e
} : decodeURIComponent;
var o = document.cookie.split("; ");
for(var u = 0, a; a = o[u] && o[u].split("="); u++) {
if(s(a[0]) === e) return s(a[1] || "")
}
return null
}

posted @ 2017-06-05 11:15  漫天风沙  阅读(1486)  评论(0编辑  收藏  举报