mirror of
https://github.com/dataarts/dat.gui.git
synced 2024-12-12 04:08:27 +00:00
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:
parent
49d31a644a
commit
194983fa7d
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user