Detect if a USB device is plugged in Javascript from browser

后端 未结 2 591
花落未央
花落未央 2021-01-07 03:20

Is there Javascript based mechanism with which i can detect, through a browser, that a user has a specific usb device plugged in?

2条回答
  •  难免孤独
    2021-01-07 04:02

    For security reasons, JavaScript in web browsers provides only restricted access to computer resources. It is not possible to store files in an arbitrary folder, start applications or communicate with a USB device.

    But there are some exceptions :

    • In legacy browsers cuch as IE6 ~ IE8 you can use ActiveX objects or Java applets to achieve this .
    • Use a chrome.usb API .
    • Write a browser plugin using NPAPI , (it is not here for long though)

提交回复
热议问题