1 Reply Latest reply on Jul 20, 2018 6:19 AM by Derek Green

    [TC51] In-browser scan withtout having focus on text field

    Simon Maurel

      Hi,

       

      I've been through a few topics speaking about in-browser scan and how you need to have focus on a text field to get input, but I could not find any solution about how to get scan events when no input is focused.

       

      Since the app I am currently working on is scan-heavy and should be based on a web browser, it is really important that the user does not have to press a button beforehand in order to trigger focus on a text input. However, I couldn't find any event that is triggered when the focus is not on a text input.

       

      Is there any configuration on DataWadge, event I didn't detect, or any other way to get scan to be detected without having to set the focus on a text input?

       

      I am working with a TC510K on Android 7.1.2 (Nougat) and DataWedge version is 6.6.50.

        • Re: [TC51] In-browser scan withtout having focus on text field
          Derek Green

          Hello,

           

          We had the same issue with capturing barcode data in a web browser without having an input.

           

          We are capturing the keypress event in Javascript like this:

           

            <script type="text/javascript">

           

                document.addEventListener("keypress", function onPress(event) {

                    

                    var displayStr=String.fromCharCode(event.keyCode);

                    // Do something with data

                    document.getElementById("display").innerHTML = document.getElementById("display").innerHTML+displayStr;

           

               });

          </script>

           

          With a Datawedge profile set to enable keystroke output.

           

          With a TC51 running Android M and Datawedge 6.3.41 this was working without any problems. However when we got a TC56 running Android N and Datawedge 6.6.50 the method above didn't work, no data was captured.

           

          What we had to do is update to the latest Datawedge 6.8.50 which gives you an additional option in the Datawedge keystroke output. This is "Inter character delay" which once set to a value meant that the javascript keypress capture above works again. We set it to 5ms.