Finalizing a Scan with a Post-Scan Action

A post-scan action allows you to execute any JavaScript on a page after the scan data is received by the page. You could navigate to a different page, switch focus to a different field, or trigger a button click; as this example demonstrates.

On this page, the example application has been configured to execute some JavaScript to locate and simulate a tap of a button. Tapping the button displays an alert. Tap the

Press the barcode reader hardware button on your device and scan a barcode. A message is displayed when a barcode is read.

Understanding Post-Scan Actions

This page contains a button, as shown:

<button id="postScanButton" onclick="alert('button clicked!');return false;">Show Message</button>

The example application is configured with the following post-scan JavaScript:

var field = document.getElementById('postScanButton');
if (field != null) {
	field.click();
}

When the device scans a barcode, after sending the barcode to the page the JavaScript is executed on the page. This invokes the button's click event; opening a alert box.