homepage Welcome to WebmasterWorld Guest from 54.166.173.147
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
Best way to synchronise browser when it's been offline
Is HTML5's local storage the way forward?
zulu_dude




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

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?

 

rocknbil




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

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. :-)

zulu_dude




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

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!).

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved