简体   繁体   English

检测 USB 设备是否从浏览器插入 Javascript

[英]Detect if a USB device is plugged in Javascript from browser

是否有基于 Javascript 的机制,我可以通过浏览器检测用户是否插入了特定的 USB 设备?

For security reasons, JavaScript in web browsers provides only restricted access to computer resources.出于安全原因,Web 浏览器中的 JavaScript 仅提供对计算机资源的受限访问。 It is not possible to store files in an arbitrary folder, start applications or communicate with a USB device.无法将文件存储在任意文件夹中、启动应用程序或与USB设备通信。

But there are some exceptions :但也有一些例外:

Your javascript code is sand boxed and therefore cannot access system resources such as usb devices.您的 javascript 代码是沙盒的,因此无法访问系统资源,例如 USB 设备。

I think the only way to access the USB devices would be to write a browser plugin.我认为访问 USB 设备的唯一方法是编写浏览器插件。 How to get USB devices List from Browser 如何从浏览器获取 USB 设备列表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM