A timeline of the last four years of detecting good old `window.localStorage`.
#### Jan Lenhart, bless his heart contributed the first patch for support: October 2009: [5059daa](https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa73426cd#L0R413) ```js (typeof window.localStorage != 'undefined') ``` #### Simplicifations November 2009: [15020e7](https://github.com/Modernizr/Modernizr/commit/15020e75cb21d29e3514570704aabfa2a9c4ca84#L0L419) ```js !!window.localStorage ``` #### If cookies disabled in FF, exception. Softer detect December 2009: [1e0ba91](https://github.com/Modernizr/Modernizr/commit/1e0ba919fa1e71172334df3fb37f5c3a07dacc49?w=1#L0R455) ```js !!('localStorage' in window) ``` #### If DOM storage disabled in IE, `window.localStorage` is _present_ but `=== null`. January 2010: [d8947c9](https://github.com/Modernizr/Modernizr/commit/d8947c91982b8018e1d119be44d9c3ed85e521b6#L0L580) ```js (localStorage in window) && window[localStorage] !== null ``` #### FF with dom.storage.enabled = false throws exceptions July 2010: [ef2c47](https://github.com/Modernizr/Modernizr/commit/ef2c47#L0R633) ```js try { return ('localStorage' in window) && window[localstorage] !== null; } catch(e) { return false; } ``` #### more shit because of FF exceptions December 2010: [c630c39](https://github.com/Modernizr/Modernizr/commit/c630c3938f704bfb4153bc939dc2eeee012e34b5?w=1) ```js try { return !!localStorage.getItem; } catch(e) { return false; } ``` #### iOS private browsing fucks everyone!!! October 2011: [5e2fa0e](https://github.com/Modernizr/Modernizr/commit/5e2fa0ed336279990b8070726c596d7aa2c00b00) ```js try { return !!localStorage.getItem('getItem'); } catch(e) { return false; } ``` #### stronger full capability test for localstorage with iOS private browsing protection October 2011: [a93625c](https://github.com/Modernizr/Modernizr/commit/a93625c21694fcda6fc1514a48f54232f703194a) ```js try { localStorage.setItem(mod, mod); localStorage.removeItem(mod); return true; } catch(e) { return false; } ```