sessionStorage 存储
存储数据 存储对象或者数组时 必须要先转化为json数据: sessionStorage.setItem(“list”,JSON.stringify(data)) ;
从缓存获取数据
var newTime = JSON.parse(sessionStorage.getItem(“list”));
localStorage 存储
存储数据 存储对象或者数组时 必须要先转化为json数据: window.localStorage.setItem(“list”,JSON.stringify(data)) ;
从缓存获取数据
var username= JSON.parse(window.localStorage.getItem(‘list’))
cookie存储
因为使用的是jquery.cookie,所以必须先引入jquery.js和jquery.cookie.jsjquery.cookie.js的下载地址
存储数据
$.cookie(“url”,name,{path:’/’});
获取数据
var playUrl = $.cookie(“url”);