Skip to content

Commit 0895348

Browse files
committed
window.sessionStorage throws an exception when cookies are disabled in some browsers
1 parent f7a7a04 commit 0895348

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/uncompressed/history.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
console = window.console||undefined, // Prevent a JSLint complain
1717
document = window.document, // Make sure we are using the correct document
1818
navigator = window.navigator, // Make sure we are using the correct navigator
19-
sessionStorage = window.sessionStorage||false, // sessionStorage
19+
sessionStorage = false, // sessionStorage
2020
setTimeout = window.setTimeout,
2121
clearTimeout = window.clearTimeout,
2222
setInterval = window.setInterval,
@@ -27,6 +27,7 @@
2727
history = window.history; // Old History Object
2828

2929
try {
30+
sessionStorage = window.sessionStorage; // This will throw an exception in some browsers when cookies/localStorage are explicitly disabled (i.e. Chrome)
3031
sessionStorage.setItem('TEST', '1');
3132
sessionStorage.removeItem('TEST');
3233
} catch(e) {

0 commit comments

Comments
 (0)