We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f57c192 + 253be58 commit 55cf306Copy full SHA for 55cf306
src/paho-mqtt.js
@@ -106,7 +106,7 @@ function onMessageArrived(message) {
106
/**
107
* @private
108
*/
109
- var localStorage = global.localStorage || (function () {
+ var localStorage = (function () {
110
var data = {};
111
112
return {
@@ -115,6 +115,14 @@ function onMessageArrived(message) {
115
removeItem: function (key) { delete data[key]; },
116
};
117
})();
118
+ try {
119
+ if (global.localStorage) {
120
+ localStorage = global.localStorage;
121
+ }
122
+ } catch (err) {
123
+ // in browsers localStorage access can be disabled / blocked and even
124
+ // reading the localStorage property will result in an Access denied error
125
126
127
128
* Unique message type identifiers, with associated
0 commit comments