From: Jörn Friedrich Dreyer Date: Wed, 2 Jan 2013 16:04:11 +0000 (+0100) Subject: use jQuery.parseJSON fallback for IE6/7/8 X-Git-Tag: v5.0.0alpha1~150^2~22^2~8 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=fe4f056a2334f8e6d77c2327eccf9cf3ebc54965;p=nextcloud-server.git use jQuery.parseJSON fallback for IE6/7/8 --- diff --git a/core/js/js.js b/core/js/js.js index 7d967321d93..5a24ba19c0c 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -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{