JQuery HTML5 QR Code Scanner using Instascan JS Example

Admin   JAVASCRIPT   49  2020-08-12 16:02:25

Are you looking for 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.

Index.html

<!DOCTYPE html>

<html>

<head>

<title>JQuery HTML5 QR Code Scanner using Instascan JS Example - </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 - </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>

You can also check this qr code:

I hope it can help you....