This article mainly describes how to determine whether the page is opened for the first time by using cookies in JS. if you need more information, you can refer to this article and paste the code directly, sorry, this article is not well written.
JScript code:
Function Cookie (key, value) {this. key = key; if (value! = Null) {this. value = escape (value);} this. expiresTime = null; this. domain = null; this. path = "/"; this. secure = null;} Cookie. prototype. setValue = function (value) {this. value = escape (value);} Cookie. prototype. getValue = function () {return (this. value);} Cookie. prototype. setExpiresTime = function (time) {this. expiresTime = time;} Cookie. prototype. getExpiresTime = function () {return this. expiresTime;} Cookie. prototype. setDomain = functi On (domain) {this. domain = domain;} Cookie. prototype. getDomain = function () {return this. domain;} Cookie. prototype. setPath = function (path) {this. path = path;} Cookie. prototype. getPath = function () {return this. path;} Cookie. prototype. write = function (v) {if (v! = Null) {this. setValue (v);} var ck = this. key + "=" + this. value; if (this. expiresTime! = Null) {try {ck + = "; expires =" + this. expiresTime. toUTCString ();} catch (err) {alert ("expiresTime Parameter error") ;}} if (this. domain! = Null) {ck + = "; domain =" + this. domain;} if (this. path! = Null) {ck + = "; path =" + this. path;} if (this. secure! = Null) {ck + = "; secure";} document. cookie = ck;} Cookie. prototype. read = function () {try {var cks = document. cookie. split (";"); var I = 0; for (I = 0; I
HTML code: