Skip to content

Commit

Permalink
Improve detecting of localStorage. Fixes #245.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake Harding committed May 29, 2013
1 parent 9b360a3 commit 12181b5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/persistent_storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ var PersistentStorage = (function() {

try {
ls = window.localStorage;

// while in private browsing mode, some browsers make
// localStorage available, but throw an error when used
ls.setItem('~~~', '!');
ls.removeItem('~~~');
} catch (err) {
ls = null;
}
Expand Down

0 comments on commit 12181b5

Please sign in to comment.