use jQuery.parseJSON fallback for IE6/7/8
This commit is contained in:
parent
03b8a065cf
commit
fe4f056a23
|
@ -343,8 +343,15 @@ if(typeof localStorage !=='undefined' && localStorage !== null){
|
|||
return localStorage.setItem(OC.localStorage.namespace+name,JSON.stringify(item));
|
||||
},
|
||||
getItem:function(name){
|
||||
if(localStorage.getItem(OC.localStorage.namespace+name)===null){return null;}
|
||||
return JSON.parse(localStorage.getItem(OC.localStorage.namespace+name));
|
||||
var item = localStorage.getItem(OC.localStorage.namespace+name);
|
||||
if(item===null) {
|
||||
return null;
|
||||
} else if (typeof JSON === 'undefined') {
|
||||
//fallback to jquery for IE6/7/8
|
||||
return $.parseJSON(item);
|
||||
} else {
|
||||
return JSON.parse(item);
|
||||
}
|
||||
}
|
||||
};
|
||||
}else{
|
||||
|
|
Loading…
Reference in New Issue