Displaying data from database when offline - Webdev

Is there a way to display data from database offline? it doesn't need to be in real time so basically you can have it whenever you connect to the site and you're online it stores an offline version of the website, this must include images, data from database, stylesheet pretty much how it would look like when you're online but just don't show realtime data.

the requirements are to have it work on all platforms, effecient, secure and to have html5 support. The data will be collected through php and displayed in html.

I was planning on using appcache but since that would get files from the server (direct files) and cache them this wouldn't work if you were to display data from databases, so each individual user will have unique data being shown depending on what is shown in the database.

The html5 canvas functionality must work aswell

Answers


You can use browser cache to keep the item. Like localstorage or Index db cache storage. For images you make it as a bytes and keep it all the time.


Since you are targetting html5, you can use localstorage to store files online.

You could for example extract what you need from the database to an XML file and read from that in js. Or maybe an sqlite database. One thing you have to note though is that any dynamic content will have to be created by javascript and not Php/python/whatever-server-side-language. Similarly for images, if you are loading them from a specific URL they will not work and you will have to use them from Localstorage etc...

That woyld mean it's very different than what you would do usually. So to avoid having to do 2 versions, you could make the online version exactly like the offline one, and check if online, reload, else use directly.

And keep in mind that you have limited space when using that approach (I think the limit depends on the browsers)


Need Your Help

python modify builtin string functions

string python-2.7 split built-in

is it possible in Python to modify, or - at least - deny of execution builtin functions? I need, for educational purpose, to make sure that strings split is unavailable.

Why not use GDI+ from ASP.NET

asp.net gdi+

I've been told that using GDI+ from ASP.NET is dangerous and undefined.