js首次打开页面提示弹窗

function get_cookie(Name) {
    var search = Name + "=";
    var returnvalue = "";
    if (document.cookie.length > 0) {
        offset = document.cookie.indexOf(search);
        if (offset != -1) {
            // if cookie exists
            offset += search.length;
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1)
                end = document.cookie.length;
            returnvalue=decodeURI(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}
setTimeout(function(){
    if (get_cookie("popped")==""){
        document.cookie="popped=yes";
        alert('这里是弹窗!');
    }
},1000);
经验jscookie提示弹窗

我来吐槽

*

*