I was given a DS4308 scanner that we use in our plants worldwide. I need to create a web application that users can use that will have an input field and when they scan I capture what is scanned into the input field to save in a database. I will be using JavaScript for this application. The app will run in a browser on a computer/tablet/laptop. It will not be an Android app but a browser app.
I followed the example in the enterprise browser scanner example at Barcode API Tutorial - Zebra Technologies TechDocs
When I open the barcode.html file in my browser it generates an error message: Uncaught SyntaxError: Unexpected token o in JSON at position 1 for the ebapi-modules.js file that is imported in the script tag.
Any suggestions on what I am doing wrong? Is the enterprise browser the correct API/SDK to use to create a web app that will collect data scanned in by the scanner?
2 Replies
I was able to get the sample application to work if I am using IE Browser without any error in console. If I try it on Chrome, I get the error message about the unexpected token in JSON message but it scans successfully.
Any reason why it generates this error message? My app will be run on Chrome in all the factories and I want to avoid support calls because they see this message.
Hi Jennifer,
It sounds as though you are not running your web application in Enterprise Browser (About Enterprise Browser 1.7 - Zebra Technologies TechDocs ) and instead using some other browser, like Chrome. If so, that would be the reason you are seeing the JavaScript message, since that JavaScript is trying to communicate with EB.
Having said all that, I am pretty sure that EB does not support the DS4308 anyway. There is no web SDK for that scanner (Symbol DS4308 Handheld Scanner Support & Downloads | Zebra ) , your best option would be to ensure the scanner is transmitting in HID mode which you should be able to do using the 123Scan tool at the previous link (it might be the default) and then capturing your data in Chrome the same way you would capture keyboard input.