Recently there was a need for Barcode decoder component in Salesforce1 using Javascript. I tried few libraries like JOB (Javascript Only Barcodereader), this post from Bob Buzzard (it uses JOB library) and QuaggaJS. And after comparing all these, decided to go with quaggajs library because of its speed. Bob Buzzard already wrote very good article on JOB library and I would suggest to try that code as well. You can find same code rewritten for lightning component here.
Quaggajs supports Code 128, Code 39, Code 39 VIN, EAN, EAN-8, UPC, UPC-E and Codabar format of Barcode.
To run this code you will need 3 static resources in your visualforce page :
- JQuery
- Bootstrap (totally optional and can be safely ignored) and
- QuaggaJs
If you want, below images can be used to try this code. Also, please note – If you are using mobile camera to capture barcode, make sure image is white else this library will not work.

