HTML page
The HTML page used to scan data can be configured with one or more scan fields. Below is an example:
<html>
<head>
<title>License Plate Test</title>
<!--
<STYLE TYPE="text/css">
body {
color: #333;
}
@media (prefers-color-scheme: dark) {
body {
color: #ddd;
background-color: #222;
}
-->
</STYLE>
<script type="text/javascript">
function onscan(platedata) {
alert( "License Plate Scan result : " + platedata );
}
function startscan(platefield) {
window.location = "readplate://"+platefield;
}
</script>
</head>
<body>
<form action="https://www.w3schools.com/action_page.php" method="GET">
<input id="platefield1" name="fname" /><br />
<input id="platefield2" name="lname" /><br />
<input onclick="startscan('platefield1')"
type="button"
value="Start scanning to field 1" />
<input onclick="startscan('platefield2')"
type="button"
value="Start scanning to field 2" />
<input name="button" type="submit" style="font-size: 20px" value="Send data to server">
</form>
</body>
</html>
Function onscan() is optional, and can be called, when a scan has been completed. Replace alert() with code updating the server with the scan code.
As to start a scan from the HTML page, and not using the toolbar scan button, it is important to use the location URL readplate://. This name is fixed, and cannot be changed.
If the toolbar scan button is used, the scan data will be send to an input field name platefield1. This name is fixed, and cannot be changed.
The CSS Style definition is used to handle the light/dark mode device type selection started in iOS 13