Search code examples
ajaxasynchronousgoogle-gears

How can a web application synch a folder of text files on the client's PC?


I want to be able to synchronize several text files on a user's PC in real time from my web application. Basically I want a few data files on the local PC to mirror the state of a user's data in my web application so if the web application or the user's internet connection is lost he can use those data files to get some critical info (possibly using html/javascript code stored in with those files that would run in offline mode on those data files.)

I know that google gears has a lot of interesting tools for working with offline state, but I'd prefer an even simpler application in html/javascript that wouldn't be as reliant on google gears. I'd rather use google gears to just create those files and slowly keep them in synch with the web application's version of data throughout the day.

Update on answers: PersistJS is a good suggestion I will look into, but I was hoping people would direct me towards really good Google Gears tutorials resources.


Solution

  • You can save data on the browser using PersistJS, which uses the best client-side persistent storage mechanism it can find, supporting:

    • Flash
    • Google Gears
    • HTML 5 storage specs
    • browser-specific extensions
    • cookies

    When your app reconnects, you can resync. Creating and reading text files is something the browser will generally block your web site from doing.