Skip to content

Commit

Permalink
catch exception when firefox has dom.storage.enabled = false
Browse files Browse the repository at this point in the history
  • Loading branch information
stepahn authored and paulirish committed Jul 7, 2010
1 parent 1f9bff6 commit ef2c47b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modernizr.js
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,12 @@ window.Modernizr = (function(window,doc,undefined){
// http://www.quirksmode.org/dom/html5.html

tests[localstorage] = function() {
return ('localStorage' in window) && window[localstorage] !== null;
// try/catch required for pissy FF behavior
try {
return ('localStorage' in window) && window[localstorage] !== null;
} catch(e) {
return false;
}
};

tests[sessionstorage] = function() {
Expand Down

0 comments on commit ef2c47b

Please sign in to comment.