[BOM]前端解析cookie为对象

参考解析页面传参

        var cookie_str = document.cookie
        var cookie_arr = cookie_str.split("; ")
        var cookie_obj = {}
        for (var i = 0; i < cookie_arr.length; i++) {
            cookie_obj[cookie_arr[i].split("=")[0]] = cookie_arr[i].split("=")[1]
        }

 这里不使用cookie_obj[cookie_arr[i].split("=")[0]] = unescape(cookie_arr[i].split("=")[1]);

posted @ 2023-01-16 21:37  夕苜19  阅读(27)  评论(0编辑  收藏  举报