From 12181b50bc95e4b2c0e719c427060a5edc96e050 Mon Sep 17 00:00:00 2001 From: Jake Harding Date: Wed, 29 May 2013 00:02:18 -0700 Subject: [PATCH] Improve detecting of localStorage. Fixes #245. --- src/persistent_storage.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/persistent_storage.js b/src/persistent_storage.js index 6b34131a..3699a578 100644 --- a/src/persistent_storage.js +++ b/src/persistent_storage.js @@ -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; }