Properly test localstorage availability

LocalStorage is not supposed to be available when browsing files
served from the filesystem (without any webserver). IE reports
window.localstorage as undefined in that case.
Source: http://caniuse.com/#search=localstorage
This commit is contained in:
Cyrille Faucheux 2017-03-22 21:27:55 +01:00 committed by Don McCurdy
parent 49d31a644a
commit 194983fa7d

View File

@ -41,7 +41,7 @@ const DEFAULT_DEFAULT_PRESET_NAME = 'Default';
const SUPPORTS_LOCAL_STORAGE = (function() { const SUPPORTS_LOCAL_STORAGE = (function() {
try { try {
return 'localStorage' in window && window.localStorage !== null; return 'localStorage' in window && window.localStorage !== null && window.localStorage !== undefined;
} catch (e) { } catch (e) {
return false; return false;
} }