qrcode_scanner.html 894 B

123456789101112131415161718192021222324252627
  1. <html>
  2. <head>
  3. <title>Html-Qrcode Demo</title>
  4. <body>
  5. <div id="qr-reader" style="width:500px;"></div>
  6. <!-- <div id="qr-reader-results"></div> -->
  7. </body>
  8. <script src="./html5-qrcode.min.js"></script>
  9. <script>
  10. const html5QrCode = new Html5Qrcode("qr-reader");
  11. // decodedText: 0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae
  12. // decodedResult: decodedResult: {"decodedText":"0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae","result":{"text":"0xd1acf1eb9c956d1e90b650dd56bed57a5df2fcae","format":{"format":0,"formatName":"QR_CODE"}}}
  13. const qrCodeSuccessCallback = (decodedText, decodedResult) => {
  14. /* handle success */
  15. alert('decodedText: ' + decodedText);
  16. };
  17. const config = { fps: 10, qrbox: 300 };
  18. // If you want to prefer back camera
  19. html5QrCode.start({ facingMode: "environment" }, config, qrCodeSuccessCallback);
  20. html5QrcodeScanner.render(onScanSuccess);
  21. </script>
  22. </head>
  23. </html>