QRCode.js is javascript library for making QRCode by davidshimjs. QRCode.js supports Cross-browser with HTML5 Canvas and table tag in DOM. QRCode.js has no dependencies.
This is an amateurish attempt (by Arno Richter) to make the original script use the ESM format and more modern class syntax. It may work for you, it may not. Take it as is.
<div id="qrcode"></div>
<script type="module">
import { QRCode } from './qrcode.esm.js';
new QRCode(document.querySelector('#qrcode'), 'https://richter.studio');
</script>
or with some options
<div id="qrcode"></div>
<script type="module">
import { QRCode } from './qrcode.esm.js';
let qrcode = new QRCode(document.querySelector('#qrcode'), {
text: 'https://richter.studio',
width: 128,
height: 128,
colorDark : "#000",
colorLight : "transparent",
correctLevel : QRCode.CorrectLevel.H
});
// and you can use some methods
qrcode.clear(); // clear the code.
qrcode.makeCode("http://naver.com"); // make another code.
</script>
Should be all modern browsers that support ESM
MIT License
Original author: twitter @davidshimjs ESM modifications by: mastodon @oelna@mas.to