localStorage解决cookie关于前端存值微信ios拦截问题

后台管理系统需要兼容手机端  iframe jquery bootstrarp

登录平台之后  登陆成功后台返回用户信息存在cookie里面,

存值:cookieuid  cookieuopenid

document.cookie="id="+ cookieuid;
document.cookie = "openid="+cookieuopenid;                        
判断 用户是否直接访问当前平台的任意一个页面除了(未登录状态)
    
if (window.frames.length != parent.frames.length) {

}else{
    window.location.href = "index.html"
}
//作了处理,当前页面不是iframe父级页面,跳转到首页
//在每个页面都作了处理,判断是否有登陆信息

取值:cookieuid  cookieuopenid

cookid = getCookie("id");
/*cookier 取值*/
userid = getCookie("openid");
cooker();
function cooker(){
    if (cookid == "") {
        window.location.href = "login.html"
    }else{

    }
}

但是有问题!!!

cookie在苹果手机微信上是无法访问的!!!但是localstorge可以!!!

存值:localStorage.setItem('', );

取值:localStorage.getItem('');

删除:localStorage.removeItem('');


猜你喜欢

转载自blog.csdn.net/weixin_38938009/article/details/79744681