document.cookie = “userJurisdiction=” + ‘true’;
頁面進入的時候,用戶權限爲true
window.addEventListener(‘beforeunload’, function (){
document.cookie = “userJurisdiction=” + null;
}, false)
頁面關閉的時候吧cookie的值改爲null
完整代碼
window.監聽用戶是否關閉了頁面
window.addEventListener(‘beforeunload’, function (){
document.cookie = “userJurisdiction=” + null;
}, false)
//發給後臺請求
Xym.getRequest({},’/後臺地址’,function(data){
根據後臺返回的值是否爲true指向下一步
if(data.linkShopInformation == true) {
**存取cookie**
document.cookie = "userJieurisdiction=" + 'true';
if(getCookie("userJurisdiction")=='true'){
addTab('/跳轉頁面地址/','完善信息')
}
}