forked from shaba/openuds
Do not attempt to reference localStorage unless it has been verified to exist.
This commit is contained in:
parent
2a0a243dd1
commit
c7ba6e84b9
@ -71,7 +71,7 @@ GuacamoleSessionStorage = (opener && opener.GuacamoleSessionStorage) || new (fun
|
||||
|
||||
// Attempt to read JSON from localStorage, default to local variable
|
||||
var json = stored_json;
|
||||
if (localStorage) {
|
||||
if (window.localStorage) {
|
||||
try {
|
||||
json = localStorage.getItem("GUACAMOLE_STATE") || "{}";
|
||||
}
|
||||
@ -96,7 +96,7 @@ GuacamoleSessionStorage = (opener && opener.GuacamoleSessionStorage) || new (fun
|
||||
|
||||
// Attempt to read JSON from localStorage, default to local variable
|
||||
var json = stored_json;
|
||||
if (localStorage) {
|
||||
if (window.localStorage) {
|
||||
try {
|
||||
json = localStorage.getItem("GUACAMOLE_STATE") || "{}";
|
||||
}
|
||||
@ -114,7 +114,7 @@ GuacamoleSessionStorage = (opener && opener.GuacamoleSessionStorage) || new (fun
|
||||
|
||||
// Attempt to set JSON within localStorage, default to local variable
|
||||
stored_json = JSON.stringify(obj);
|
||||
if (localStorage) {
|
||||
if (window.localStorage) {
|
||||
try {
|
||||
localStorage.setItem("GUACAMOLE_STATE", stored_json);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user