HTML5是否允许您与浏览器中的本地客户端文件进行交互? [英] Does HTML5 allow you to interact with local client files from within a browser

查看:401
本文介绍了HTML5是否允许您与浏览器中的本地客户端文件进行交互?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看过一些关于访问客户端机器上的文件的帖子,也就是问题

我正在尝试跳转我不断更新云计算的范例,这样我的用户就可以通过访问网页来访问最新版本。这要求程序/网页可以从一个目录开始,递归地检查其中的文件,并根据找到的结果计算结果。最后,它也应该能够将结果文件写入客户端的文件系统。



上一个问题中的答案之一提到了Google Gears,但是现在已经停止了赞成HTML5。
是否可以在HTML5中访问客户端目录?如何?

我知道为什么通过任何网页访问本地文件是一个安全风险,但为了我的目的,我没有问题要求用户获得适当的权限。 / p>

解决方案

不,至少不是。然而,您在这里有许多选择。



目前您最好的选择是:
$ b $ ul

  • 从桌面拖放文件,请参阅 a教程

  • 使用输入类型文件。


    • 使用File API读取内容或提交表单。阅读 Mozilla开发人员中心关于动态阅读文件的更多信息。

    • 您可以指定多个属性来一次读取和打开多个文件,而不必具有单独的字段。
    • 不可见的输入和触发点击就可以打开文件打开对话框。请参阅以前的Mozilla开发人员中心链接了解详情。
    • 它允许你创建,删除,读取,修改文件系统上的文件。注意:你得到一个沙盒目录,你不能像这样访问整个系统。
    • 使用Java和签名applet 来访问整个文件系统。这要求用户接受签名。


    I've seen some posts regarding access to files on a client machine by a webpage, namely this question.

    I'm trying to hop on the "continuously update in the cloud" paradigm for some algorithms I am writing so my users can access the latest versions by simply accessing the webpage. This requires that the program/webpage can start with a directory and recursively inspect files within it and compute results based on what is found. In the end it also should be able to write the results file to the client's filesystem.

    One of the answers in that previous question mentions Google Gears but that has since been discontinued in favor of HTML5. Is access to a client directory possible within HTML5? How?

    I know why access by any webpage to local files is a security risk, but for my purpose I have no problem to ask the user for the appropriate permissions.

    解决方案

    No, not directly at least. However, you have a number of choices here.

    Currently your best choices are:

    • Drag and drop files from desktop, see a tutorial.
    • Use input type file.
      • Read the contents with the File API or submit the form. Read more on Mozilla Developer Center about reading the file dynamically.
      • You can specify multiple attribute to read and open multiple files at once without having to have separate fields.
      • You can have an invisible input and "trigger a click" on it to open the file open dialog. See the previous Mozilla Developer Center link for details.
    • Use the FileSystem API which allows you to create, delete, read, modify files on the file system. Note: you get a sandboxed directory to work with, you can't access the whole system just like that.
    • Use Java with signed applets to access the whole file system. This requires the user to accept the signature.

    这篇关于HTML5是否允许您与浏览器中的本地客户端文件进行交互?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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