We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 24cc5c0 + 988592b commit 2c38441Copy full SHA for 2c38441
1 file changed
browser.js
@@ -21,7 +21,7 @@ var storage;
21
if (typeof chrome !== 'undefined' && typeof chrome.storage !== 'undefined')
22
storage = chrome.storage.local;
23
else
24
- storage = window.localStorage;
+ storage = localstorage();
25
26
/**
27
* Colors.
@@ -156,3 +156,20 @@ function load() {
156
*/
157
158
exports.enable(load());
159
+
160
+/**
161
+ * Localstorage attempts to return the localstorage.
162
+ *
163
+ * This is necessary because safari throws
164
+ * when a user disables cookies/localstorage
165
+ * and you attempt to access it.
166
167
+ * @return {LocalStorage}
168
+ * @api private
169
+ */
170
171
+function localstorage(){
172
+ try {
173
+ return window.localStorage;
174
+ } catch (e) {}
175
+}
0 commit comments