Showing posts with label Mobile. Show all posts
Showing posts with label Mobile. Show all posts

Thursday, 16 June 2016

Browsers give away device name through user agent - Et tu Browser!

My mobile browser has been letting the websites I visit know what handset I use and I wouldn't have known this until I saw this targeted ad - an ad for case for Lumia 530

I knew about browser user-agent strings, but today I learnt that browsers give away device model name as well, through the user agent they expose -
Mozilla/5.0 (Windows Phone 8.1; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 530 Dual SIM) like Gecko

Saturday, 12 March 2016

HOW TO scan a barcode with Android smartphone camera from a web page

If you need a barcode to be scanned from a mobile web app & then get back the code as text from the scanner, the ZXing ("Zebra Crossing") open-source, multi-format 1D/2D barcode image processing library & ZXing Barcode Scanner can help.

Note that this web page will only work when opened within an Android browser & smartphone with camera having ZXing Barcode Scanner installed

Here are the steps for a simple demo:
1. Create a webpage to initiate the bar code scanner through anchor tag.

When the ZXing Barcode Scanner application is installed on an Android device, a URL call to: zxing://scan/?ret=http://example.azurewebsites.net/desc.html?code={CODE}
..will bring up the device bar code reader so that the user can scans the code. The code is returned via the callback URL parameter supplied in the zxing URL.
2. ZXing Barcode Scanner will present the code to the file desc.html. To show that the code is in fact returned, I use a document.write(location.href); to show the returned barcode text