bar code QR code scanning

Processing a QR code is pretty easy in javascript (or, rather, there are several libraries that can handle this). The main issue is gaining access to your device’s camera to get a live streaming video, which is pretty much the only way to make QR code scanning feasible.

Within the last couple years many browsers have begun adding the ability to access the device’s camera from Javascript via the Media Streaming standard (aka getUserMedia). HTML5 support is slightly older, but didn’t provide a way of accessing the camera from Javascript (it focused on uploading photos/videos to a server). Mobile browsers (ironically) have lagged behind the most in adding streaming support. Android only got this feature with version 5 (Lollipop) and iOS still does not support it. See the following URLs for more details:


The official specification is still in the draft phase, making this technology pretty bleeding edge (although I think it’s probably stable at this point).

I’d expect general support (especially on mobile devices) to firm up in the next year or so, at which point a javascript-based QR code scanner will become much more feasible. I have personally taken an interest in this and actually built out a prototype roughly a year ago, but the mobile browser support was so bad back then that it was pretty much unusable. It’d be fun to revisit, now that Android has added support.

The following contains quote a lot of assumptions and guesses. It’s not be rigorously tested, so definitely take with a grain of salt:

The Salesforce1 app uses a “web view” to render HTML content (I assume), so support for javascript APIs is going to be dependent on whatever browser is running on the system (guessing: they could override default browser capabilities to add or even remove support). On iOS, I’d guess that Salesforce1 is using Safari (even Chrome for iOS uses a Safari WebView, or so I’ve heard). On Android, I’m not sure if Salesforce1 uses the standard Android browser or if it respects a user-overridden default. In either case, it’ll be dependent on the capabilities of the system’s browser. So it’s possible that a QR scanner would work in Salesforce1 on one Android device but not on another, depending on the OS version and the default browser selected by the user.