Question

I am new to HTML5,very sorry if my question sounds silly to you. I want to understand HTML5 offline capacity. AIM is that application developed will save data in local database (browser) and when application is online the changes will be sent to the server for synchronization,similarly local database will be synchronized with remote database periodically or server will push changes to client. I was reading about HTML5 web databases,but I found that it is deprecated. There is one more support available called as IndexDB. can any one please tell me to accomplish this task which one I should focus? Is it possible with HTML5 as of now?

Was it helpful?

Solution

As I am not 100% sure what you are after.

Here is some quality reading information on these topics.


Storage:

Dive Into HTML5 Storage provides a lot of useful information on localStorage.

localStorage works as key : value so it is quite easy and nice to use.

localStorage.setItem("key", "value");
localStorage.getItem("key");

Offline Caching:

I would suggest reading up on using an appcache.

Dive Into HTML5 Offline provides a lot of useful information on this.


Updating your database:

As for updating your data base you would need to send the data from the client to the server the most simple way of doing this would be having your server accept a HTTP POST from the web page.

Take a look at the jQuery POST. The best way to do this would probably be to create an array of your localStorage and POST the array to the server. You could have a look at formatting this as JSON or XML etc.

Your web server here would have to accept the HTTP POST and then have logic to handle the data that is provided from the client. E.g: Add it to / update your server side DB.


Note that Dive Into HTML5 is now open source and on GitHub

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top