1

Recently I've found that I can use pure HTML, CSS and JS to build Android app (and iOS also maybe), by using PhoneGap. I guess it converts HTML pages to Android web views. So basically I'll have ~10 HTML files, calling each other, get data from Server (it's Java and Tomcat) via Ajax and JSONP.

And my problem is about storing user data with these static local HTML files.

As they are local files, I can't use Cookie. But somehow Session's still working, so with each HTML page, I can set an onload event that sends an Ajax request, then get data. But it's very inconvenient, I have to do that for the same data each time I switch to another HTML file. So, is there any solution I can load all data when the first HTML file is loaded, store data somewhere, then reuse these data in others HTML files ? Thank you so much for reading my question.

Stephan Muller
  • 27,018
  • 16
  • 85
  • 126
Liberty
  • 345
  • 1
  • 4
  • 10
  • You can use localstorage http://stackoverflow.com/questions/14599615/phonegap-with-javascript-global-variable – ReZa Jun 04 '16 at 18:47
  • This answer might help you out: http://stackoverflow.com/questions/29986657/global-variable-usage-on-page-reload/30070207#30070207 – Stephan Muller Jun 06 '16 at 07:33

0 Answers0