-
Notifications
You must be signed in to change notification settings - Fork 0
/
twotap.html
42 lines (37 loc) · 1.45 KB
/
twotap.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
38
39
40
41
42
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Connect to Wi-Fi Network</title>
</head>
<body>
<h1 class="ssid">👋 Welcome</h3>
<p>To connect to this WiFi network:
<ol>
<li>Long press the QR code below.</li>
<li>Press on the QR code again.</li>
<li>Press <b>Join</b>.</li>
You may have to wait up to 15 seconds to get a connection.
</ol>
</p>
<img id="longpress" src="" alt="WiFi QR Code (long press me)">
<canvas id="qrcanvas"></canvas>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrious/4.0.2/qrious.min.js"></script>
<script src="script.js"></script>
<script>
(function () {
let url = new URL(window.location);
let qr = new QRious({
element: document.getElementById('qrcanvas'),
value: `WIFI:T:WPA;S:${decode(url.searchParams.get("ssid"))};P:${decode(url.searchParams.get("pw"))};;`
});
document.getElementById('qrcanvas').style.opacity = "0";
// document.write(document.getElementById('qrcanvas').toDataURL())
document.getElementById("longpress").src = document.getElementById('qrcanvas').toDataURL()
})();
</script>
</body>
</html>