Skip to content

Commit 30f7ce9

Browse files
jayphelpsbillmag
authored andcommitted
fixed an issue in Safari's Private Browsing mode where setItem throws an exception
1 parent 6d54ade commit 30f7ce9

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

scripts/uncompressed/history.js

+11-2
Original file line numberDiff line numberDiff line change
@@ -1899,8 +1899,17 @@
18991899
History.store = currentStore;
19001900
History.normalizeStore();
19011901

1902-
// Store
1903-
sessionStorage.setItem('History.store',JSON.stringify(currentStore));
1902+
// In Safari, going into Private Browsing mode causes the
1903+
// Session Storage object to still exist but if you try and use
1904+
// or set any property/function of it it throws the exception
1905+
// "QUOTA_EXCEEDED_ERR: DOM Exception 22: An attempt was made to
1906+
// add something to storage that exceeded the quota." infinitely
1907+
// every second.
1908+
try {
1909+
// Store
1910+
sessionStorage.setItem('History.store',JSON.stringify(currentStore));
1911+
}
1912+
catch (e) {}
19041913
};
19051914

19061915
// For Internet Explorer

0 commit comments

Comments
 (0)