views:

949

answers:

5

I am creating a prototype that will be run in a web browser. I would like to store (and retrieve) various info submitted by a user during the use of the prototype. I know I can retrieve a variety of file formats such as xml, json... and I know I can do local storage using the plugin jstore. So I suppose I can do a convoluted solution where I get the first xml load from a starter file and then use local storage after it is manipulated and just check for local storage.

I do not want to use PHP or ASP or other scripts as I need to be able to share the prototype with senior execs who will not have webservers running and I do not want to install the prototype on the webserver... but perhaps that is the best way to do this as I know javascript can not write to the local file system for security reasons. On the otherhand maybe I am making the combination of getting the initial xml and using the jstore plugin sound harder than it really is.

+1  A: 

The web platform is specifically designed to prevent sites from writing arbitrary data to client machines. There are a few exceptions to this that you can explore:

  • A plugin like Google Gears; or data store in HTML5 (not widely available) (easily lost)
  • Cookies (easily lost)
  • URL (limited by length, easily lost)
  • Files (more conventional albeit clumsy)

The web clearly operates better from a server. If you are hoping to deploy desktop installs, you can deploy a thick application that uses a lot of browser-based UI. That app could easily have access to the local system for files, etc. If a possibility, please comment.

Michael Haren
A: 

If the limitations of using Internet Explorer and all those issues of trust (permission to write to a users file system using javascript is probably only ever going to be possible on an intranet) then you can use the Scripting.fileSystemObject as per this msdn page.

davidsleeps
A: 

You can use flash for storing data. By default it allows you store up to 100 kb and you can have more with getting permission from user.

You can find more information from google

kara
A: 

This might be a solution for some situations.

Force 'save as...' dialog box (Firefox only)

But it requires user interaction.

John
A: 

This link should help you.

http://jquery.tiddlywiki.org/twFile.html

Icarus