Have had a web application successfully using http post method of printing to our Zebra 230's for years now, but just recently started having issues. It seems any PC cannot print, but our android devices can. I'm guessing it is most likely due to browser issues, (perhaps after updates??). Have tried multiple browsers on the PC (chrome, ie, ff) though and none are working. Can successfully print to the printer through Zebradesigner from same PCs, so know it's not a network/connection issue.
Anyone else noticing this?
9 Replies
Do you see any specific error messages? Chrome debug mode can help to see what exact error is from the pstprnt request. The pstprnt may not have been kept up to date with the latest versions of the browsers.
There are no thrown errors.
I checked in chrome debugger and only noticed a flag on the line -
request.setRequestHeader("Content-Length", zpl.length); *Refused to set unsafe header "Content-length"
Researched and found that it shouldn't be necessary to set content-length, so tried commenting out that line.
Still not working from any PC on the network or from any browser (chrome, ie, ff) but works just fine from any android or ios device using chrome or safari.
I am not extremely familiar with chrome debugger, let me know if there is something further I can explore with it, thanks for the input!
In general, browsers for desktop or PC are different from the browsers for mobile devices. A POST request for pstprnt is as simple as shown below.
Can you share the code around the pstprnt, so we can see what's been put into the request?
I have not tried using curl but can give it a try. We have been using the provided javascript:
Please comment out the Content-Length header and try again. The pstprnt does not use the Content-Length header.
I had read that too and tried with it commented out as well (noted in the post above) and it didn't make a difference, it still only worked with mobile browsers and no PC browser.
Not sure what else could cause the failure in your case without additional exception trace or error msg. This HTTP Post example of pstprnt works just fine for me with Chrome on Mac and Windows. You can copy the link and paste it into the address box to download the zip file.
I finally came back to this issue, sorry have been away. I have resolved the issue and the script you provided helped.
I had found that my script was throwing CORS errors due to 'origin' and assumed it was the issue. Although identical, I ran your provided script and it too threw the same errors....but it actually printed! Only difference was it's origin was 'null'. This lead me to digging in a more precise area and found this:
"August 25, 2021: Chrome is deprecating access to private network endpoints from non-secure websites as part of the Private Network Access specification. "
https://developer.chrome.com/blog/private-network-access-update/
.... which is when we started having issues. The whole fix....have to call it from within the same CORS origin -OR- have a valid SSL cert and must call via https. Thanks for the assistance!
Nice, thank you very much!
__________________________
Blog