如何在 JavaScript 中加载文件列表?
如何从 JavaScript 中的指定文件夹加载文件列表?
更新
实际上来自 Xul 应用程序,但我认为本地 html 文件的任何内容都可以工作..(它是一个独立的应用程序)。我说的是资源文件(图像)。
How do I load a list of files from a specified folder in javascript?
update
Actually is from a Xul application, but I think anything for a local html file will work.. (it's a standalone app). And are resource files (images) I'm talking about..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这可以在 Firefox 插件中实现,并且已经存在多年了。请参阅 MDC 上的以下页面: https://developer.mozilla.org/en/ Code_snippets/File_I%2F%2FO
It's possible within a Firefox plug-in and has been for years. See the following page on MDC: https://developer.mozilla.org/en/Code_snippets/File_I%2F%2FO
如果该文件夹是用户选择的,您可以使用 HTML5 File[1] API 来读取文件:
If the folder is user-selected you can use the HTML5 File[1] APIs to read the files:
如果你谈论的是浏览器中的 JS 并访问客户端机器上的文件,则不能。出于安全原因,Javascript 无法访问文件系统。
If you're talking about JS in a browser and accessing files on the client's machine, you can't. Javascript has no access to the filesystem for security reasons.