diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-02 20:04:11 +0400 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-01-02 20:13:23 +0400 |
commit | fe4f056a2334f8e6d77c2327eccf9cf3ebc54965 (patch) | |
tree | aa074e979e4b49a01a306d7097dc33feebc3ee42 /core | |
parent | 03b8a065cf37c040452b567a2a9050f637cbda94 (diff) |
use jQuery.parseJSON fallback for IE6/7/8
Diffstat (limited to 'core')
-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 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{ |