Defining an On-Page Scan Handler

On this page, the barcode reader on your device is used to populate a div element using a custom JavaScript handler, which is defined on the page itself.

Press the barcode reader hardware button on your device and scan a barcode. The barcode information should be displayed below.

Barcode information will appear here

Understanding Scan Handling

The page contains a meta tag within its head tag, as shown:

<meta http-equiv="ScannerNavigate" 
      content="Javascript:onScannerNavigate('%s', '%s', '%s', '%s', '%s', '%s');"/>

The page contains a div with an id of messageDiv:

<div id="messageDiv"></div>

The JavaScript handler (onScannerNavigate) receives the barcode information and displays it like so:

<script type="text/javascript">
    function onScannerNavigate(barcodeData, deviceId, symbology, timestamp, dataLength, label)
        var messageDiv = document.getElementById("messageDiv");
        messageDiv.innerText =
            label + "<br />"
            + barcodeData + "<br />"
            + deviceId + "<br />"
            + symbology + "<br />"
            + timestamp + "<br />"
            + dataLength;