W3C home > Mailing lists > Public > public-webapps@w3.org > July to September 2009

Re: Web Storage how to check for support?

From: Jonas Sicking <jonas@sicking.cc>
Date: Wed, 5 Aug 2009 21:42:17 -0700
Message-ID: <63df84f0908052142r3dab0428y4ca5c61bb1b4001a@mail.gmail.com>
To: Joo Eiras <joaoe@opera.com>
Cc: (wrong string) ‚‚ŠŒ†”–„—Ÿ <j.chetwynd@btinternet.com>, public-webapps@w3.org
2009/8/1 Joo Eiras <joaoe@opera.com>:
>> How can one in a script check for UA support?
>> else if(localStorage){}
>> does not work for Opera**.
> Hi.
> This obviously does not work because you need to prefix localStorage with
> window "if(window.localStorage)" else the script breaks because localStorage
> is a undefined identifier while window.localStorage looks up a property in
> the window. Different things, specific to ecmascript itself.

No, the window object is the global object where all global variables
are defined. Try the following:

a = 10;

/ Jonas
Received on Thursday, 6 August 2009 04:43:24 UTC

This archive was generated by hypermail 2.3.1 : Friday, 27 October 2017 07:26:18 UTC