-
-
Save piyawath/0323088d80a0c4beda977455b1ec0a43 to your computer and use it in GitHub Desktop.
Revisions
-
paulirish revised this gist
May 13, 2013 . 1 changed file with 9 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ A timeline of the last four years of detecting good old `window.localStorage`. <hr> #### 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') @@ -14,7 +14,7 @@ https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa7 #### Simplicifations November 2009: [15020e7](https://github.com/Modernizr/Modernizr/commit/15020e75cb21d29e3514570704aabfa2a9c4ca84#L0L419) ```js !!window.localStorage @@ -23,7 +23,7 @@ https://github.com/Modernizr/Modernizr/commit/15020e75cb21d29e3514570704aabfa2a9 #### 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) @@ -32,7 +32,7 @@ https://github.com/Modernizr/Modernizr/commit/1e0ba919fa1e71172334df3fb37f5c3a07 #### 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 @@ -41,7 +41,7 @@ https://github.com/Modernizr/Modernizr/commit/d8947c91982b8018e1d119be44d9c3ed85 #### FF with dom.storage.enabled = false throws exceptions July 2010: [ef2c47](https://github.com/Modernizr/Modernizr/commit/ef2c47#L0R633) ```js try { @@ -54,7 +54,7 @@ try { #### more shit because of FF exceptions December 2010: [c630c39](https://github.com/Modernizr/Modernizr/commit/c630c3938f704bfb4153bc939dc2eeee012e34b5?w=1) ```js try { @@ -68,7 +68,7 @@ try { #### iOS private browsing fucks everyone!!! October 2011: [5e2fa0e](https://github.com/Modernizr/Modernizr/commit/5e2fa0ed336279990b8070726c596d7aa2c00b00) ```js try { @@ -82,7 +82,7 @@ try { #### stronger full capability test for localstorage with iOS private browsing protection October 2011: [a93625c](https://github.com/Modernizr/Modernizr/commit/a93625c21694fcda6fc1514a48f54232f703194a) ```js try { -
paulirish revised this gist
May 13, 2013 . 1 changed file with 51 additions and 31 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,72 +4,92 @@ 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: https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa73426cd#L0R413 ```js (typeof window.localStorage != 'undefined') ``` #### Simplicifations November 2009: https://github.com/Modernizr/Modernizr/commit/15020e75cb21d29e3514570704aabfa2a9c4ca84#L0L419 ```js !!window.localStorage ``` #### If cookies disabled in FF, exception. Softer detect December 2009: 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: 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: 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: 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: 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: https://github.com/Modernizr/Modernizr/commit/a93625c21694fcda6fc1514a48f54232f703194a ```js try { localStorage.setItem(mod, mod); localStorage.removeItem(mod); return true; } catch(e) { return false; } ``` -
paulirish revised this gist
May 11, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,7 @@ A timeline of the last four years of detecting good old `window.localStorage` <hr> #### Jan Lenhart, bless his heart contributed the first patch for support: https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa73426cd#L0R413 -
paulirish renamed this gist
May 11, 2013 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,3 @@ #### Jan Lenhart, bless his heart contributed the first patch for support: https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa73426cd#L0R413 -
paulirish created this gist
May 11, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,72 @@ #### Jan Lenhart, bless his heart contributed the first patch for support: https://github.com/Modernizr/Modernizr/commit/5059daa4674651cd1adc39d902e4f4afa73426cd#L0R413 (typeof window.localStorage != 'undefined') #### Simplicifations https://github.com/Modernizr/Modernizr/commit/15020e75cb21d29e3514570704aabfa2a9c4ca84#L0L419 !!window.localStorage #### If cookies disabled in FF, exception. Softer detect https://github.com/Modernizr/Modernizr/commit/1e0ba919fa1e71172334df3fb37f5c3a07dacc49?w=1#L0R455 !!('localStorage' in window) #### If DOM storage disabled in IE, `window.localStorage` is _present_ but `=== null`. https://github.com/Modernizr/Modernizr/commit/d8947c91982b8018e1d119be44d9c3ed85e521b6#L0L580 (localStorage in window) && window[localStorage] !== null #### FF with dom.storage.enabled = false throws exceptions https://github.com/Modernizr/Modernizr/commit/ef2c47#L0R633 try { return ('localStorage' in window) && window[localstorage] !== null; } catch(e) { return false; } #### more shit because of FF exceptions https://github.com/Modernizr/Modernizr/commit/c630c3938f704bfb4153bc939dc2eeee012e34b5?w=1 try { return !!localStorage.getItem; } catch(e) { return false; } #### iOS private browsing fucks everyone!!! https://github.com/Modernizr/Modernizr/commit/5e2fa0ed336279990b8070726c596d7aa2c00b00 try { return !!localStorage.getItem('getItem'); } catch(e) { return false; } #### stronger full capability test for localstorage with iOS private browsing protection https://github.com/Modernizr/Modernizr/commit/a93625c21694fcda6fc1514a48f54232f703194a try { localStorage.setItem(mod, mod); localStorage.removeItem(mod); return true; } catch(e) { return false; }