Monday, October 17, 2011

iOS5 in Private Browsing Mode

I love feature detection. Sometimes it fails you in a really unfortanate way.
Two examples of late


> window.localStorage
 ▶ StorageConstructor

> window.localStorage.setItem('foo', 'bar')
> Error: QUOTA_EXCEEDED_ERR: DOM Exception 22



Q: Guess what most libraries do to detect support?

A: if ('localStorage' in window)


Well, nothing a try catch can't fix.

/facepalm

No comments: