Skip to content

Instantly share code, notes, and snippets.

@BlairDuncan
Created October 23, 2011 16:40
Show Gist options
  • Save BlairDuncan/1307562 to your computer and use it in GitHub Desktop.
Save BlairDuncan/1307562 to your computer and use it in GitHub Desktop.
@implementation CPUserDefaultsLocalStore(FixForPrivateBrowsingExceptionError)
- (void)setData:(CPData)aData
{
// wrapping in a try/catch so as to not send a DOM Exception error when Private Browsing is enabled
try
{
localStorage.setItem(_domain, encodeURIComponent([aData rawString]));
}
catch (e)
{
// unable to write to localStorage
}
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment