Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e5661b0

Browse filesBrowse files
author
jed apostol
committed
Any call to local storage must be wrapped inside a try catch, due to Safari not allowing localStorage in private browsing mode
1 parent d85d4d7 commit e5661b0
Copy full SHA for e5661b0

File tree

Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-2
lines changed

‎js/history.js

Copy file name to clipboardExpand all lines: js/history.js
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ var Josh = Josh || {};
2828
var _key = config.key || 'josh.history';
2929

3030
if (_storage) {
31-
var data = _storage.getItem(_key);
31+
try {
32+
var data = _storage.getItem(_key);
33+
} catch(e) {
34+
_console.log("Error accessing storage");
35+
}
3236
if (data) {
3337
_history = JSON.parse(data);
3438
_searchCursor = _cursor = _history.length - 1;
@@ -37,8 +41,10 @@ var Josh = Josh || {};
3741
}
3842
}
3943
function save() {
40-
if (_storage) {
44+
try {
4145
_storage.setItem(_key, JSON.stringify(_history));
46+
} catch(e) {
47+
_console.log("Error accessing storage");
4248
}
4349
}
4450

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.