views:

289

answers:

6

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.

A: 

you could use the File System Object FSO through javascript, however it is dependant on Microsoft as it is an ActiveX control, it would also require permissions in the browser, or perhaps a HTA (HTML Application).

http://www.webreference.com/js/column71/

Its a real security issue so most avenues are closed down inhrentley.

A: 

Inherently the web model was designed not to authorize upstream from server to client. Now things are changing slowly maybe could you do this with Websocket ?

Rebol Tutorial
A: 

Risking of stating the obvious; if you want to store user state locally, isn't cookies the standard way? maybe more then one cookie will be needed, but that sounds like the simplest of ways.

eLAN
+9  A: 

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.

orip
A: 

You're going to need to make an ActiveX control and a FireFox plugin to get these permissions. Short of that I agree with orip try using PersistJS

RHicke
A: 

You can ask the user to download a subversion client that is predefined to interface with your subversion server only. Then write your web application to interface with the subversion service from your side only.

There is a good deal of security harm associated with granting access to a user's file system so you will want to lock down all possible points of exploitation. You will want to ensure that the user cannot access the subversion server except through the client that you ask them to install. You will want to ensure the connection between the application server and the subversion server is extremely secure so that the transmission path cannot be compromised and that malicious logic that may be loaded onto the application server cannot access the subversion server. I would say to encrypt the transmission path between those two servers and put the subversion server behind the firewall separating your network DMZ. I would also suggest use a challenge/response mechanism between the application server and the subversion server to prevent malicious code from appearing to be legitimate decisions made on the application server. Also, ensure that data only flows form the application server to the subversion server in a unidirectional fashion only, because if there is malicious logic planted on your application server then any data that comes from the subversion server is compromised without even accessing that server.