Callback URL

It is possible to start the scanner from a HTML page in Safari, and get the result back in the same page/tab.

Syntax:

  mochalpr://CALLBACKHASH=url

Example:

  mochalpr://CALLBACKHASH=http://mochasoft.com/plateios4.htm

A simple HTML plateios4.htm page

Source for plateios4.htm:
    
    
<head>
        
<script type="text/javascript">
  function startscan() {
    platefieldresult.value ="";
    window.location = "mochalpr://CALLBACKHASH="+window.location;
  }
  function load_from_url_callback() {
  var str1= window.location.hash.substring(1);
    if (str1) {
      var str2 = platefieldresult.value
      var n = str1.localeCompare(str2);
      if (n != 0)  {
        // new license plate value is ready to be processed
        platefieldresult.value = str1;
      }
    }
  }
        
  var x = setInterval(function() {
    load_from_url_callback()
  },1000);
                            
                            
</script>
</head>
<body>
        
  <h3>License Plate Reader test page with callback , using callback to same page and # parameter</h3>
  <input onclick="startscan()" type="button" value="Start mocha LPR scanner app" /> <<br>
  <br>
  <h3>Result:</h3>
  <input id="platefieldresult" /><br />
</body>
</html>