Welcome to WebmasterWorld Guest from

Forum Moderators: incrediBILL

Message Too Old, No Replies

Best way to synchronise browser when it's been offline

Is HTML5's local storage the way forward?



12:03 pm on Nov 22, 2011 (gmt 0)

10+ Year Member

I'm developing an HTML-based system that enables employees to access information in a database and then update the info periodically. It's fairly critical that the information entered into the 'terminal' (i.e. the web browser) is sent to the server so that all terminals can be synchronised.

In a perfect world, the web browser would always have a flawless connection to the internet, but as we know, that's not the case!

My question is, what would be the best way of overcoming this? I'm able to specify that users use a certain browser, so could specify that they have to use an HTML5 compatible browser (with local storage).

My current thinking is that I'll have an indicator in the application that shows users if their connection is offline. If it is, they will still be allowed to enter data but it will all get stored in local storage, ready to be synced as soon as the browser is online again.

One potential issue is what happens if the browser is closed before it syncs.

Can anyone think of a better method?


5:18 pm on Nov 22, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

The conditions are a little hazy . . . exactly what does your app do, and how does it do it?

Rule 1: Never rely on user actions (they will find a way to mess it up, this is a mathematical certainty)

Rule 2: Never rely on some client condition, including browser type or version (or other device) for your program to function properly.

What I mean by both of those is there should be some internal mechanism to keep things "synchronized." A cron job? Expiring cache headers? See question #1. :-)


9:21 am on Nov 23, 2011 (gmt 0)

10+ Year Member

The app enables employees at various locations to stay up to date with the same information... kind of like a CRM accessed from multiple locations. The difference is that they still need to be able to enter information if they have a connectivity lapse, whereas office based workers would just have a tea break until the connection was restored.

Due to the conditions the app is going to be running in, I'm able to specify a minimum browser requirement, so am happy to rely on an HTML5 feature such as local storage. But you're quite right, there does need to be a way to sync it all together once the browser is back online and is able to send its locally stored data. That can be dealt with server-side in PHP.

I've done a little more research on local storage and have found that it's persistent between browser sessions. This would make it perfect for my needs, so the main headache is now the server-side problem of ensuring it's all in sync.

I'm loving HTML5 already (assuming this all works!).

Featured Threads

Hot Threads This Week

Hot Threads This Month