开发者

Write local file with jQuery or Javascript

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 f开发者_高级运维or 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.


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.


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.


I agree with all the opinion that it is difficult to store data in client side using JavaScript. If we have to create a stand alone application then adobe air seems to be promising. As per specs and features stated by adobe we can use JavaScript and html skill to create an application also it allows you to read /write to a local storage in file or database.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜