Skip to content
Browse files

Firefox throws a security error when attempting to access localStorag…

…e, but IE9 just returns null, so check for it before setting _storage_service
  • Loading branch information...
1 parent a39db70 commit eee0552253ed34faf2e07b7cdcf5c05c8ee0f4e3 @stopdropandrew stopdropandrew committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 jstorage.js
View
6 jstorage.js
@@ -162,8 +162,10 @@
/* Check if browser supports localStorage */
if("localStorage" in window){
try {
- _storage_service = window.localStorage;
- _backend = "localStorage";
+ if(window.localStorage) {
+ _storage_service = window.localStorage;
+ _backend = "localStorage";
+ }
} catch(E3) {/* Firefox fails when touching localStorage and cookies are disabled */}
}
/* Check if browser supports globalStorage */

0 comments on commit eee0552

Please sign in to comment.
Something went wrong with that request. Please try again.