Read a bar code via phone camera from webpage - not mobile app?

Read a bar code via phone camera from webpage - not mobile app?

  

Is there a way to read a bar code from a webpage (not the pluggin for the mobile app)?

Hi Jason,

Do you mean that a barcode is on a web page, or that you want to read a barcode in a webapp using the webcam?

Kilian Hekhuis wrote:

Hi Jason,

Do you mean that a barcode is on a web page, or that you want to read a barcode in a webapp using the webcam?

I want to read a barcode in the real world using my phone, but NOT in an app.  Just from a normal webpage.  Is there a way to do that?


Solution

Hi Jason,

The short answer is you can't do that. JavaScript cannot access devices for security reasons (that's why we need Cordova plugins on mobile apps in the first place).

However, if you know the user has installed a particular barcode scanning app it may be possible to communicate with it via URLs (see e.g. here).

Solution

Kilian, thanks!  That is what I figured.  If we were going to do/require an app we would make our own but it was a desire to not have to require people to download an app.