使用 javascript 获取可移动驱动器列表?
我的情况是这样的:我想通过JavaScript从浏览器打开一个弹出框,然后我希望弹出框显示它可以看到连接到您的计算机的所有可移动设备,然后您将能够选择并写入到一个等
My situation is this: I want to have a pop-up box open from your browser via JavaScript then I want the pop-up box to display all removable devices it can see attached to your computer, then you will be able to select and write to one etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Web 浏览器向 JavaScript 提供的 API 不包含任何访问用户文件系统的能力(在标准安全上下文中)
The APIs made available to JavaScript by web browsers do not include any ability to access the user's filesystem (in a standard security context)
Javascript 仅限于浏览器级别,因此无法读取/写入文件,更不用说获取可移动驱动器的列表了......这些限制的存在是有原因的......
想象一下,如果没有限制,那么 JavaScript 代码背后的网页可能会对您的系统做非常非常恶意的事情,例如删除重要的系统文件,在用户不知情的情况下轻松感染机器,浏览时的整个内容将立即被杀死,并有大量僵尸计算机运行大量机器人垃圾邮件/黑客/病毒/恶意软件的滋生地...令人不快的情况...
这就是为什么Javascript在安全性方面受到如此严格的限制,并且仅限于浏览器可以显示/呈现的内容。没有文件 I/O、系统 I/O 等。
希望这有帮助,
此致,
汤姆.
Javascript is confined to the browser level, and hence cannot read/write to files, let alone get a list of removable drives...The restrictions are there for a reason...
Imagine if there was no restrictions, a javascript code behind a web page could do very very malicious things to your system such as removing vital system files, easily infect a machine without the user ever knowing about, the whole thing on browsing would be killed instantly and have loads of zombie computers operating a big massive bot spamming/hacking/breeding ground for viruses/malware...unpleasant scenario...
That is why Javascript is so restricted in terms of security and confined to only what the browser can display/render. No File I/O, System I/O etc..
Hope this helps,
Best regards,
Tom.
看看这是否对您有帮助。
See if this will help you.
我不太确定(我是新手),但我认为你只能通过 AJAX 交互来做到这一点。 JavaScript 本身只能在客户端运行,无法访问计算机本身。
我在谷歌上发现了这个搜索:
但似乎有点......缺乏,因为它只能在 Windows 上运行,而且它做的事情不多。
I'm not pretty sure (I'm a newbie) but I think you can do that only with AJAX interaction. JavaScript itself only works on client side, without access to the computer itself.
I found this searching on google:
But seems like a bit... lacking, since it onlu works on Windows, and it doesn't do too much.