30 lines
725 B
HTML
30 lines
725 B
HTML
<script src="html5-qrcode.min.js"></script>
|
|
<style>
|
|
.result{
|
|
background-color: green;
|
|
color:#fff;
|
|
padding:20px;
|
|
}
|
|
.row{
|
|
display:flex;
|
|
}
|
|
</style>
|
|
<div class="row">
|
|
<div class="col">
|
|
<div style="width:500px;" id="reader"></div>
|
|
</div>
|
|
|
|
</div>
|
|
<br>
|
|
<a href="https://reeteshghimire.com.np/2021/05/27/access-camera-and-read-qr-code-using-javascript/">Uses This Code</a>
|
|
<script type="text/javascript">
|
|
function onScanSuccess(qrCodeMessage) {
|
|
window.location.href=qrCodeMessage;
|
|
}
|
|
function onScanError(errorMessage) {
|
|
//handle scan error
|
|
}
|
|
var html5QrcodeScanner = new Html5QrcodeScanner(
|
|
"reader", { fps: 10, qrbox: 250 });
|
|
html5QrcodeScanner.render(onScanSuccess, onScanError);
|
|
</script> |