LocalStorage not working in HTML5 app

367 views
Skip to first unread message

stymie

unread,
Mar 12, 2012, 9:49:59 PM3/12/12
to Google Web Toolkit
I am using phonegap to wrap a HTML5 app. I am using GWT's localstorage
mechanism. When I add this to my project I just get a blank page. But
if I remove the localstorage code it works. It does work just fine in
my desktop browser however, but once I put it on the phone.... Blank
Page.

Is there some problems with GWT local storage on Mobile?

James Tyner

unread,
Mar 12, 2012, 9:59:02 PM3/12/12
to Google Web Toolkit
By the way I am using Windows Phone 7

James Tyner

unread,
Mar 12, 2012, 10:02:38 PM3/12/12
to Google Web Toolkit
Well I checked for a null on my storage. It *is* returning null. But on the website html5test.com it does show that localStorage is supported?

Colin Eberhardt

unread,
Mar 20, 2012, 2:23:45 AM3/20/12
to Google Web Toolkit
Hi James,

I am not sure what the exact problem is here, but I might be able to
point you in the general direction. Windows Phone 7 does support local
storage, however, it is not enabled for files served from isolated
storage, which is where your PhoneGap files reside. This is much like
the way that some desktop browsers do not support local storage for
HTML files served from the filesystems.

To ovecome this problem, the PhoneGap team created a 'shim'
implementation of localStorage, which uses Silverlight isolates
storage for persistence. However, this shim does not provide exactly
the same interface as the real localStorage object. For example, it
does not support getting / setting keys via string indexers. Looking
at the GWT implementation it does use the getItem, setItem functions
which are present on the shim, but there might be some other issues.

I would suggest using JavaScript via JSNI to interface with
localStorage directly.

Colin E.

On Mar 13, 2:02 am, James Tyner <jamesty...@gmail.com> wrote:
> Well I checked for a null on my storage. It *is* returning null. But on the
> website html5test.com it does show that localStorage is supported?
>
>
> On Mon, Mar 12, 2012 at 9:59 PM, James Tyner <jamesty...@gmail.com> wrote:
> > By the way I am using Windows Phone 7
>

dodo dard

unread,
Mar 21, 2012, 4:29:17 AM3/21/12
to google-we...@googlegroups.com
You can test and look how to use HTML5 in : www.html5bydemo.com
Reply all
Reply to author
Forward
0 new messages