Callback URL using hash character (From v 1.7)

It is possible to start the scanner from a HTML page in Safari, and get the result back in the same page/tab.
If Safari receives a callback with an existing URL, as if you scan the same barcode 2 times with below test page, the page will be reloaded and any state data on the page will be lost.





A simple HTML test2a.htm page

Source for test2a.htm:
<script type="text/javascript">
  function startscan() {
    barcodefieldresult.value ="";
    window.location = "mochabarcode://CALLBACKHASH="+window.location;
  function load_from_url_callback() {
  var str1= window.location.hash.substring(1);
    if (str1) {
      var str2 = barcodefieldresult.value
      var n = str1.localeCompare(str2);
      if (n != 0)  {
        // new barcode value is ready to be processed
        barcodefieldresult.value = str1;
  var x = setInterval(function() {
  <h3>Barcode test page with callback , using callback to same page and # parameter</h3>
  <input onclick="startscan()" type="button" value="Start mocha barcode scanner app" /> <<br>
  <input id="barcodefieldresult" /><br />