diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-02 17:11:39 +0100 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-02 17:11:39 +0100 |
commit | ac98ac34ea07fb0482743944897099d57e8be018 (patch) | |
tree | a5b560a873e77b2afe9169102eec90b20333cdae /core/js | |
parent | 3ca199f8bbd946a28f198b934a88bead579e0e9c (diff) | |
download | nextcloud-server-ac98ac34ea07fb0482743944897099d57e8be018.tar.gz nextcloud-server-ac98ac34ea07fb0482743944897099d57e8be018.zip |
use jQuery.parseJSON fallback for IE6/7/8
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/js.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js index de24995ef13..e3590c1f4f9 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -306,8 +306,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{ |