]> source.dussan.org Git - nextcloud-server.git/commitdiff
use jQuery.parseJSON fallback for IE6/7/8
authorJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 2 Jan 2013 16:04:11 +0000 (17:04 +0100)
committerJörn Friedrich Dreyer <jfd@butonic.de>
Wed, 2 Jan 2013 16:13:23 +0000 (17:13 +0100)
core/js/js.js

index 7d967321d93b97465f7abfb2a3b5bb4a1a79b46c..5a24ba19c0c9971bdc9411ea8fed4ab2caadc618 100644 (file)
@@ -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{