cookie 判断用户的登录状态 cookie:存的数据量少,可以设置过期时间,浏览器关掉就过期了,不安全,跨域有问题,不推荐使用 localstorage :存的数据量大,不过期,除非删掉 sessionstorage:浏览器关闭后就会过期 存cookie document.cookie="username=zs"//username和zs为键值对形式 取cookie(取出的字符串要用split处理) document.cookie