use a more robust check if html5 localStorage is available

This commit is contained in:
Sebastian Sdorra
2014-04-04 08:04:29 +02:00
parent 014220a45b
commit 4ada31a83c

View File

@@ -574,9 +574,20 @@ Sonia.scm.Main = Ext.extend(Ext.util.Observable, {
});
Ext.onReady(function(){
function isLocalStorageAvailable(){
var mod = '__scm-manager';
try {
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch(e) {
return false;
}
}
var stateProvider;
if ( typeof(Storage) !== "undefined" ){
if (isLocalStorageAvailable()){
if (debug){
console.debug('use localStore to save application state');
}