summaryrefslogtreecommitdiffhomepage
path: root/main.mjs
diff options
context:
space:
mode:
authorLi Zhineng <[email protected]>2025-06-12 23:07:50 +0800
committerLi Zhineng <[email protected]>2025-06-12 23:07:50 +0800
commitd7016f285fbef4b45650043ddbcea0da68d8a64c (patch)
treeb061bacf84463f9a140975a4b59168776ab671ed /main.mjs
parentfc084dbcb34a2906036510c354e3e82bc507a61b (diff)
downloadsetup-d7016f285fbef4b45650043ddbcea0da68d8a64c.tar.gz
setup-d7016f285fbef4b45650043ddbcea0da68d8a64c.zip
display unsupported browser message
Diffstat (limited to 'main.mjs')
-rw-r--r--main.mjs13
1 files changed, 11 insertions, 2 deletions
diff --git a/main.mjs b/main.mjs
index 618efa0..31d4056 100644
--- a/main.mjs
+++ b/main.mjs
@@ -216,5 +216,14 @@ function handleDeviceResponse(event) {
console.log(`Received data from device: ${receivedBytes.join(' ')}`)
}
-const button = document.getElementById('connect')
-button.addEventListener('click', connect)
+function supportBluetoothApi() {
+ return 'bluetooth' in navigator
+}
+
+if (! supportBluetoothApi()) {
+ const unsupportedMessage = document.getElementById('unsupported-message')
+ unsupportedMessage.style.display = 'block'
+
+ const main = document.querySelector('main')
+ main.style.display = 'none'
+}