-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqr-code-generator.html
48 lines (46 loc) · 1.38 KB
/
qr-code-generator.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
43
44
45
46
47
48
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>QR Code Generator</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
background-color: #f0f0f0;
}
#qrcode {
background: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<div id="qrcode"></div>
<script>
// Get the full query string from the URL
const queryString = window.location.search.substring(1);
// If there's a query string, generate QR code
if (queryString) {
new QRCode(document.getElementById("qrcode"), {
text: decodeURIComponent(queryString),
width: 256,
height: 256,
colorDark: "#000000",
colorLight: "#ffffff",
correctLevel: QRCode.CorrectLevel.H
});
} else {
document.getElementById("qrcode").innerHTML =
"<p>Add text after ? in URL to generate QR code</p>";
}
</script>
</body>
</html>