-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
37 lines (30 loc) · 1018 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"/>
</head>
<body>
<h3>Web usb super test from hell.</h3>
<h4>Q. What is WebUSB ?</h4>
<p>A. WebUSB is a chrome bases pending standard, implemented in chrome since version 54. It give to websites the capacity to connect to USB devices, with the client approval and in secured environment (https) only.<p>
<button id="#readmeup">READ THE FUCK OUT OF IT !</button>
<script>
$('body').on('click','#readmeup',()=>{
navigator.usb.requestDevice({
filters: [{ vendorId: 0x2341 }]
});
});
navigator.usb.getDevices().then((devices) => {
console.log("all stuff :");
console.log(devices);
})
navigator.usb.addEventListener('connect', (event) => {
console.log("new stuff :");
console.log(event.device);
});
navigator.usb.addEventListener('disconnect', (event) => {
console.log("old stuff :");
console.log(event.device);
});
</script>
</body>
</html>