'Barcode scanner on browser is not showing camera but Enter barcode value (empty value will fire the error handler)
I am using following library for barcode scanner
https://ionicframework.com/docs/native/barcode-scanner
$ ionic cordova plugin add phonegap-plugin-barcodescanner
$ npm install @awesome-cordova-plugins/barcode-scanner
Run ionic application on browser using this cmd :
ionic cordova run browser
code for scan is below:
scanCode() {
this.barcodeScanner.scan().then(barcodeData => {
this.scannedData = barcodeData.text;
}).catch(err => {
console.log('Error', err);
});
}
There are two issues using the browser :
In the case below command, it is showing below error.
ionic serve
error on console.log :
common.js:350 Native: tried calling BarcodeScanner.scan, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
Error cordova_not_available
cordova.js is already in www/index.html
- then I decided to run on browser with Cordova plugin
ionic cordova run browser
Scanner button below showing msg
I need camera not message like this... For android and iOS platform .. It is working well but if I run application for browser it is not showing camera. Any suggestion??
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

