用jQuery或Javascript编写本地文件 [英] Write local file with jQuery or Javascript

查看:106
本文介绍了用jQuery或Javascript编写本地文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个将在Web浏览器中运行的原型.我想存储(和检索)用户在使用原型期间提交的各种信息.我知道我可以检索各种文件格式,例如xml,json ...,而且我知道可以使用插件jstore进行本地存储.因此,我想我可以做一个复杂的解决方案,即从启动文件中获取第一个xml负载,然后在对其进行操作后使用本地存储,然后检查本地存储.

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.

我不想使用PHP或ASP或其他脚本,因为我需要能够与不会运行网络服务器的高级执行人员共享原型,并且我不想在网络服务器上安装原型...但是也许这是执行此操作的最佳方法,因为我知道javascript出于安全原因无法将其写入本地文件系统.另一方面,也许我正在使获取初始xml和使用jstore插件的组合听起来比实际要难.

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.

推荐答案

该Web平台专门用于防止站点将任意数据写入客户端计算机.您可以探索一些例外情况:

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:

  • 类似于Google Gears的插件;或HTML5中的数据存储(不广泛使用)(容易丢失)
  • 饼干(容易丢失)
  • URL(受长度限制,容易丢失)
  • 文件(尽管比较笨拙)

通过服务器,网络显然可以更好地运行.如果希望部署桌面安装,则可以部署使用大量基于浏览器的UI的胖应用程序.该应用可以轻松访问本地系统中的文件等.如有可能,请发表评论.

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.

这篇关于用jQuery或Javascript编写本地文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆