Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Window.LocalStorage on iOs
Message
 
 
À
23/11/2015 14:00:42
Information générale
Forum:
HTML5
Catégorie:
Stockage local
Divers
Thread ID:
01627762
Message ID:
01627821
Vues:
33
>>>
>>>OK. I did the same type of thing on an app a few months ago. Couple of tips:
>>>
>>>You can add two eventlisteners to monitor online/offline status (works on Ipad Mini with Safari). I use that to disable/enable (and color code) a button which triggers sending/receiving data from the server. See: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine/onLine
>>>
>>>If the data structure permits I'd seriously consider using JSon objects rather than XML since it is far more compact and is probably what you will need for data on the client side. It's just as easy to have Web API return JSon as XML.....
>>>
>>>HTH,
>>>Viv
>>
>>Ok; I can consider switching from using XML to Json; I just need to learn how to do it :). But another aspect that is a problem now (without WiFi) is as follows. Most of the pages (aspx) of the application use lookups (drop-down lists). for example, drop-down list of employees. This drop-down (in my application) lists are filled in LOAD method dynamically. Now I need to change it and instead of loading them (about 20 of them) dynamically, store them in a localStorage and then dynamically retrieve them from the local storage. Do you think this is practical/feasible?
>
>Absolutely. But (and your not going to like me for this because it entails another technology :-} ) it is easiest when using a framework such as angularJs.
>Using that you can populate a dropdown in HTML with something like:
<select  data-ng-model="vm.selectedThing" data-ng-options="l.Name for l in things"></select>
>
>>
>>When you say "have Web API return JSon", now comes a very newbie question (since I have not yet learned Web API), is Web API something that is installed on a tablet (iPad) or is it a URL to the server that calls some service running on the server?
>
>WebAPI is in ASP.NET (i.e. Server side). If you sent a request to Web API from the client specifying 'Accept:application/json' in the headers the returned data will automatically be converted to JSon objects in the response. (For XML it's 'Accept: application/xml)
>

I still like you :). And I like the simplicity of populating the dropdown using Angular.js. Do you know if Angular.js would have some functions to store data into the localStorage? Or I have to do it "manually"?

Thank you for all your help! (if not for an important football game tonight, I would continue learning WebAPI tonight, but I have a contractual obligation to my team to watch them :)).
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform