Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access to USB stick from website?

I'm planning to make a login system by USB, so if you put in a USB-drive and open a specific webpage, the website asks the USB-drive for the code (e.g. by a JavaScript file, a redirect or something like that).

The problem is, because of sandboxing, you can't load or redirect to local files. I don't know a solution for this problem. Can you guys help me? I don't need specific code, just an example or something in that way.

like image 703
maxdaniel98 Avatar asked Nov 04 '13 22:11

maxdaniel98


People also ask

How do I access my USB drive from the Internet?

Select the USB device you need to connect to and then press Connect USB Device to access the files. Another method to access USB storage files is a router with USB port. Connect the USB flash drive to your home router. Some routers come with a USB port where you can plug in a USB device and then access its data.

How do I view the contents of a USB on my computer?

Insert the flash drive into a USB port on your computer. You should find a USB port on the front, back, or side of your computer (the location may vary depending on whether you have a desktop or a laptop). Depending on how your computer is set up, a dialog box may appear. If it does, select Open folder to view files.

Why can't I browse my USB files?

In addition to virus infection, there are other causes that may lead to USB not showing files: Files and folders on your pen drive are hidden. Data is accidentally deleted. The file system is not recognized by the OS of your computer.


2 Answers

Maybe you can read up on USB-HID. Wikipedia:

The USB human interface device class (USB HID class) is a part of the USB specification for computer peripherals: it specifies a device class (a type of computer hardware) for human interface devices such as keyboards, mice, game controllers and alphanumeric display devices.

Here are some references:

  • USB HID (Human Interface Device)
  • node-hid - Access USB HID devices from node.js
  • DepthJS: 'Allows any web page to interact with the Microsoft Kinect using Javascript'.
  • A related Stackoverflow question: Write data to USB HID using Javascript, HTML5, or any cross platform language (supports Android)
like image 191
sigma Avatar answered Sep 28 '22 00:09

sigma


One other possibility is to check out the Chrome HID (Human Interface Device) APIs:

  • Interacting with USB HID devices from web apps – via Chrome Apps, see below
  • Relevant Chrome API docs

Please note that for the time being, you cannot interact directly with the USB device (i.e. you cannot access any WebAPI offering that kind of fine-grained control).

Building a Chrome App (different from a Chrome Extension) may help; This article may point you in the right direction, since it also provides sample code.

like image 39
Dr1Ku Avatar answered Sep 28 '22 00:09

Dr1Ku