加密对象到locastorage / 从 locastorage解密对象
var obj={name:"致远",age:21,address:"江西上饶XXXX",hobby:"看书,编程"};
//用中文 记得加encodeURIComponent()!
localStorage.setItem("obj",window.btoa(window.encodeURIComponent(JSON.stringify(obj))));
//用中文 记得加decodeURIComponent()!
var obj=JSON.parse(decodeURIComponent(window.atob(localStorage.getItem("obj"))));
console.info(obj);