The answer to question 1 is to explicit set the expire time of the cookie.
Only then the mobile device sets the cookies from sesion cookie to a long life one and the mobile browser recognize it again and can load and restore the cookie.
Plain JavaScript:
var timeInSeconds = 60;
document.cookie = 'token=XX;expires='+timeInSeconds+';path=/';
With js-cookies:
var timeInDays = 1;
Cookies.set("token", "XX", {
expires: timeInDays,
path: "/",
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…