js判断当前页面是不是第一次被访问

    if(document.cookie.indexOf("a=hello")==-1){
        alert("首次打开!");
        var t=new Date(new Date().getTime()+1000*60*60*24*30);
        document.cookie="a=hello; expires="+t.toGMTString();
    }else{
        alert("再次打开!");
    }

猜你喜欢

转载自blog.csdn.net/qq_41229582/article/details/80632855