updated iOS private notes for localStorage. also a stronger test. · Modernizr/Modernizr@a93625c · GitHub
Skip to content

Commit

Permalink
updated iOS private notes for localStorage. also a stronger test.
Browse files Browse the repository at this point in the history
This was initiated due to a commit i saw from lindsey simon:
  https://github.com/andris9/jStorage/pull/18/files
  • Loading branch information
paulirish committed Oct 21, 2011
1 parent 1e82aef commit a93625c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions modernizr.js
Original file line number Diff line number Diff line change
@@ -711,19 +711,22 @@ window.Modernizr = (function( window, document, undefined ) {
// `('localStorage' in window) && ` test first because otherwise Firefox will
// throw http://bugzil.la/365772 if cookies are disabled

// Also in iOS5 Private Browsing mode, attepting to use localStorage
// Also in iOS5 Private Browsing mode, attepting to use localStorage.setItem
// will throw the exception:
// QUOTA_EXCEEDED_ERRROR DOM Exception 22.
// Peculiarly, getItem and removeItem calls do not throw.

// Because we are forced to try/catch this, we'll go aggressive.

// FWIW: IE8 Compat mode supports these features completely:
// Just FWIW: IE8 Compat mode supports these features completely:
// http://www.quirksmode.org/dom/html5.html
// But IE8 doesn't support either with local files

tests['localstorage'] = function() {
try {
return !!localStorage.getItem('getItem');
localStorage.setItem(mod, mod);
localStorage.removeItem(mod);
return true;
} catch(e) {
return false;
}

1 comment on commit a93625c

@paulirish
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx to bibi360 for help testing!! :D

Please sign in to comment.