window.dxconsoleMemory = (new (function(){
////声明一个变量,用于确定使用哪个本地存储函数
var storage;
if(window.localStorage){ //当localStorage存在,使用H5本地存储方式
storage = localStorage;
}else{
storage = cookieStorage;
}
this.set = function(key, value){
storage.setItem(key, value);
};
this.get = function(name){
return storage.getItem(name);
};
this.remove = function(key){
storage.removeItem(key);
};
this.clear = function(){
storage.clear();
};
})());
本地存储 - localStorage
猜你喜欢
转载自blog.csdn.net/sx_lidan/article/details/80803976
今日推荐
周排行