Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/iagolast/qrcodejs
Javascript library to read QR codes in the browser
https://github.com/iagolast/qrcodejs
Last synced: 24 days ago
JSON representation
Javascript library to read QR codes in the browser
- Host: GitHub
- URL: https://github.com/iagolast/qrcodejs
- Owner: IagoLast
- Created: 2016-06-10T17:27:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-29T19:48:19.000Z (almost 8 years ago)
- Last Synced: 2024-10-10T08:44:40.844Z (29 days ago)
- Language: JavaScript
- Size: 192 KB
- Stars: 17
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# QrCode.js
Javascript library to read QR codes in the browser
# Installation
Note: The script creates a grobal variable named QrReader, in future versions this library will be compatible with
different module loaders.## Using Bower
Install the library using:
bower install --save qrcode-reader.js
Use it from the html.
```html
```## Using Npm
npm i qrcode-reader.js
Use it from the html.
```html
```## Manually including scripts
Download the javascript file from the next link and add it to your source:https://raw.githubusercontent.com/IagoLast/qrcodejs/master/dist/qrcode.js
# Simple example
This code creates a webcam canvas which border will turn green when a code is readed.
```html
QRCode.js
function onSuccess(data) {
document.getElementById('video').setAttribute("style", "border: 3px solid #52e250");
console.log('Sucess:', data);
}function onError(err) {
console.error(err);
}QrReader.getBackCamera().then(function(device) {
new QrReader({
sucessCallback: onSuccess, // Required
errorCallback: onError, // Required
videoSelector: '#video', // If not provided creates an invisible element and decode in background
stopOnRead: true, // Default false, When true the video will stop once the first QR is read.
deviceId: device.deviceId, // Id of the device used for recording video.
});
});```
## Author
@iagolast## License
MIT