47 lines
1.6 KiB
HTML
47 lines
1.6 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Dark Theme Centered H1 with Tailwind</title>
|
|
<!-- Include Tailwind CSS from CDN -->
|
|
<link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet">
|
|
<style>
|
|
body {
|
|
background-color: #000;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="flex flex-col justify-center items-center h-screen text-white bg-black">
|
|
<h1 class="text-4xl font-bold text-purple-800 p-4 block">Xreal, meet the Web.</h1>
|
|
<br/>
|
|
|
|
|
|
<!-- Button to kick off a USBHID session device request -->
|
|
<button id="usbhid-button" class="block mt-4 bg-purple-800 hover:bg-purple-700 text-white font-bold py-2 px-4 rounded">
|
|
Start USBHID Session
|
|
</button>
|
|
|
|
<script>
|
|
// Get the button element
|
|
const usbhidButton = document.getElementById('usbhid-button');
|
|
|
|
// Add event listener for the button click
|
|
usbhidButton.addEventListener('click', async () => {
|
|
// Request USB device
|
|
let device;
|
|
try {
|
|
device = await navigator.usb.requestDevice({ filters: [{ vendorId: 0x2341 }] });
|
|
} catch (err) {
|
|
console.error("No device was selected", err);
|
|
}
|
|
|
|
// If device is selected, start a session
|
|
if (device !== undefined) {
|
|
console.log("USBHID session started with device: ", device.productName);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|