1 Reply Latest reply on Oct 18, 2017 8:31 AM by joe marlow

    BrowserPrint - access is denied...

    joe marlow

      Trying to incorporate BrowserPrint into an existing jsp and I'm seeing this (from F12 Developer tools) when I hit my page:

       

       

           SCRIPT5: Access is denied.
           File: BrowserPrint-1.0.4.min.js, Line: 1, Column: 95

       

       

       

      Using IE11 and the js files are installed on Tomcat server.

       

       

       

       

       

       

      Snippet (browserprint code taken from an example found here):

          <script type="text/javascript" src="../lib/jquery-1.11.1.min.js"></script>
          <script type="text/javascript" src="../lib/BrowserPrint-1.0.4.min.js"></script>
          <script type="text/javascript">
         
                 // set vars for printing from resultset   
                 var controlnumber = <%=rst.getLong("controlnumber")%>;
                 var dname = "<%try{out.print(rst.getString("deliveryname"));} catch(Exception e){out.print(" ");}%>";
                 var daddr = "<%try{out.print(rst.getString("deliveryaddress"));} catch(Exception e){out.print(" ");}%>";
                 var daddr2 = "<%try{out.print(rst.getString("deliveryaddress2"));} catch(Exception e){out.print(" ");}%>";
                 var dcity = "<%try{out.print(rst.getString("deliverycity"));} catch(Exception e){out.print(" ");}%>";
                 var dstate = "<%try{out.print(rst.getString("deliverystate"));} catch(Exception e){out.print(" ");}%>";
                 var dzip = "<%try{out.print(rst.getString("deliveryzip"));} catch(Exception e){out.print(" ");}%>";
                 var dphone = "<%try{out.print(rst.getString("deliveryphone"));} catch(Exception e){out.print(" ");}%>";
              var reference = "<%try{out.print(rst.getString("reference"));} catch(Exception e){out.print(" ");}%>";
               var reference2 = "<%try{out.print(rst.getString("bolnumber"));} catch(Exception e){out.print(" ");}%>";
               var reference3 = "<%try{out.print(rst.getString("reference2"));} catch(Exception e){out.print(" ");}%>";
                 var pname = "<%try{out.print(rst.getString("pickupname"));} catch(Exception e){out.print(" ");}%>";
                 var pphone = "<%try{out.print(rst.getString("pickupphone"));} catch(Exception e){out.print(" ");}%>";
                 var pieces = <%try{out.print(rst.getInt("pieces"));} catch(Exception e){}%>;
                 var dinstruc = "<%try{out.print(rst.getString("deliveryinstructions"));} catch(Exception e){out.print(" ");}%>";

       

                  // print string (partial for testing)
                  var format_start = "^XA";
                  var txtToPrint = "^FO50,50^BY3^BCN,100,T,N.N^FD" + barcode + "^FS";
                  txtToPrint = txtToPrint + "^FO600,50^A0N,50^FD" + p + " of " + pieces + "^FS";
                  txtToPrint = txtToPrint + "^FO50,200^A0N,50^FDTo: " + dname + "^FS";
                  txtToPrint = txtToPrint + "^FO50,300^A0N,32^FD" + daddr + "^FS";
                 var format_end = "^FS^XZ";
                 
                  alert("print string built.."); // This alert pops..
         
            BrowserPrint.getDefaultDevice('printer', function(printer) {
             if((typeof printer != "undefined") && (printer.connection == undefined)) {
                      alert("No Printer Found");
                      // give option to choose printer
                   }
                   else {
                      alert(printer.name); // This alert does not pop - why???
                      printer.send(format_start + txtToPrint + format_end);
                  }
              },

              function(error_response) {
                  // This alert doesn't pop either
                  alert(    "An error occured while attempting to connect to your Zebra Printer. " +
                          "You may not have Zebra Browser Print installed, or it may not be running. " +
                          "Install Zebra Browser Print, or start the Zebra Browser Print Service, and try again.");
              }

          );