I have a dynamic HTML document that does not contain any external resources (no images, css and scripts are coded inside of document). Using PhoneGap I have converted this document into standalone Android application. As this HTML document is local application with no internet connectivity, using cookies is unfortunately not an option. I need to save/load application status to allow user to continue to use/run the application later. Using cookies was a working solution in Windows environment using IE browser, but because most of browsers do not allow to use cookies for local files, this solution is not supported by browser on my Android device (default browser of Samsung Galaxy Tab2 7.0). What is an alternative solution to allow save/load some JavaScript/jQuery variable(s) for later use?
Share
Take a look at HTML5’s localStorage. It gives you all the features of cookies, and more, in a simple key-value store. Ex:
Then, next time your app launches:
Local storage is now the preferred way to do local storage of data anyway, and some people also block most cookies for privacy reasons, so this is the way to go.