後臺管理系統需要兼容手機端 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('');