Ah, of course.

But why do we need both "'localStorage' in window" and
"window['localStorage'] !== null; "?

Regards

On Thu, Sep 22, 2011 at 2:11 PM, David Hong <david.g.h...@gmail.com> wrote:

>
> On 22/09/2011, at 8:19 PM, Anders Jönsson wrote:
>
> > function supports_html5_storage() {
> >    try {
> >        return typeof window.localStorage !== 'undefined';
> >    } catch (e) {
> >        return false;
> >    }
> > }
>
> `try.. catch` is being used here because Firefox 4 (beta to be specific).
> There were cases when Firefox 4 Beta threw an error[1]. Check the link and
> read the comments for more information.
>
>
>
> > And can we also remove the try...catch?:
>
>
> It should be okay to remove them now.
>
>
>
> [1] https://github.com/Modernizr/Modernizr/blob/master/modernizr.js#L700
>
> --
> To view archived discussions from the original JSMentors Mailman list:
> http://www.mail-archive.com/jsmentors@jsmentors.com/
>
> To search via a non-Google archive, visit here:
> http://www.mail-archive.com/jsmentors@googlegroups.com/
>
> To unsubscribe from this group, send email to
> jsmentors+unsubscr...@googlegroups.com
>



-- 

Anders

http://andersjonsson.blogspot.com
@anjonsson

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/jsmentors@jsmentors.com/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/jsmentors@googlegroups.com/

To unsubscribe from this group, send email to
jsmentors+unsubscr...@googlegroups.com

Reply via email to