I usually go with local storage, you can store objects too. Ex:
var userInfo = {
"username": "Bob",
"roleName": "Admin",
"image": "img/userPic.jpg",
};
//Store the object in local storage
localStorage.setItem('loggedUser', JSON.stringify(userInfo));
then on the other page you can simply do:
var userInfo = JSON.parse(localStorage.getItem("loggedUser"));
var userName = userInfo.username;
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…