I show a button to open the camera using phonegap:
document.addEventListener("deviceready", loaded, false); function loaded() { pictureSource = navigator.camera.PictureSourceType; destinationType = navigator.camera.DestinationType; } function capturePhoto() { navigator.camera.getPicture(getPhoto, onFail, { quality : 50 }); } function getPhoto(imageData) { alert(imageData); var smallImage = document.getElementById('cameraPic'); smallImage.style.display = 'block'; smallImage.src = "data:image/jpeg;base64," + imageData; } function onFail(message) { alert('Failed because: ' + message); } <body> <div id="camera"> <button class="camera-control" onclick="capturePhoto();">CapturePhoto</button> <div style="text-align: center; margin: 20px;"> <img id="cameraPic" src="" style="width: auto; height: 120px;"> <img> </div></div> </body>
When I click the button, I want to decode the QR code and get the decoded value shown on my page. I want to do this using only javascript and phonegap, and don't want to use any native code.
source share