Skip to content

Instantly share code, notes, and snippets.

@spinogrizz
Last active March 10, 2023 23:14
Show Gist options
  • Save spinogrizz/bb5862831fc2ec9086e14690b5af08a5 to your computer and use it in GitHub Desktop.
Save spinogrizz/bb5862831fc2ec9086e14690b5af08a5 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA==" crossorigin="anonymous" referrerpolicy="no-referrer">
</script>
<script>
function render_qr() {
let container = document.getElementById("qrcode");
const urlSearchParams = new URLSearchParams(window.location.search);
const params = Object.fromEntries(urlSearchParams.entries());
let code = params.code;
//code = "test"
new QRCode(container, {
text: code,
width: 300,
height: 300,
colorDark : "#000000",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
});
}
</script>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 70%;
}
#qrcode { width: 65%; }
#qrcode img { width: 100%; }
</style>
</head>
<body onload="render_qr()">
<div id="qrcode"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment