📌  相关文章
📜  javascript cookie 5 分钟后过期 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:13.238000             🧑  作者: Mango

代码示例1
function createCookie(name,value,minutes) {
    if (minutes) {
        var date = new Date();
        date.setTime(date.getTime()+(minutes*60*1000));
        var expires = "; expires="+date.toGMTString();
    } else {
        var expires = "";
    }
    document.cookie = name+"="+value+expires+"; path=/";
}

createCookie("name", "value", 5)