JQuery HTML5 QR Code Scanner using Instascan JS

qr code scanner script using jquery html5? If yes then i will defiantly help to create simple example for qr code or barcode reader using webcam or mobile camera. we will use instascan js plugin for qr code scan.

Instascan JS is a real-time webcam-driven HTML5 QR code scanner. Instascan JS wil help to find all camera attach with your system or mobile and you can read barcode using anyone that you want.

So, basically, you have to copy bellow html code and run in your system. Then i also attach qr code for demo. So let’s see.

<!DOCTYPE html>
<html>
<head>
	<title>JQuery HTML5 QR Code Scanner using Instascan JS</title>
	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
	<script src="https://rawgit.com/schmich/instascan-builds/master/instascan.min.js"></script>
</head>
<body>
  
    <h1>JQuery HTML5 QR Code Scanner using Instascan JS Example - ItSolutionStuff.com</h1>
    
    <video id="preview"></video>
    <script type="text/javascript">
      let scanner = new Instascan.Scanner({ video: document.getElementById('preview') });
      scanner.addListener('scan', function (content) {
        alert(content);
      });
      Instascan.Camera.getCameras().then(function (cameras) {
        if (cameras.length > 0) {
          scanner.start(cameras[0]);
        } else {
          console.error('No cameras found.');
        }
      }).catch(function (e) {
        console.error(e);
      });
    </script>
   
</body>
</html>

About Author

Leave a Reply

Your email address will not be published. Required fields are marked *

PAGE TOP
error

Enjoy this blog? Please spread the word :)

RSS
Follow by Email