Print Portal: Cannot see client printers or print button is missing when using Chrome
Symptoms
When using client printing with Print Portal in Chrome, the list of client printers fails to load and the print button may disappear from the UI.
When looking at the browser console, you may see an error like this one:
Access to XMLHttpRequest at 'http://127.0.0.1:5952/Client/GetId/?_=1645721935000' from origin 'http://print.seagullscientific.com' has been blocked by CORS policy: The request client is not a secure context and the resource is in more-private address space `local`. core-libraries.min.js?buildNumber=175838:2
GET http://127.0.0.1:5952/Client/GetId/?_=1645721935000 net::ERR_FAILED
Environment
BarTender 2021 and later
Print Portal with client printing enabled
Chrome v98 or later.
Solution
The error message stems from a feature called Private Network Access (formerly known as CORS-RFC1918), which limits the ability of websites to send requests on a private network when the website isn't running with secure protocols. When Print Portal is requesting a list of local printers to display on the Print Portal UI, it makes one of these CORS requests.
When Print Portal has HTTPS enabled, these CORS requests work just fine in Chrome. However, if HTTPS is not enabled, these CORS requests are now restricted and cannot be completed. To fix this issue, Print Portal will need to have HTTPS enabled to use client printing when using a Chrome browser.
- To enable HTTPS for your own Print Portal, please follow this article: Secure Print Portal with HTTPS.
- If you are seeing this issue with our public Print Portal, please use this URL to access our Print Portal demo site: https://print.seagullscientific.com/
Additional resources
Please see the following articles for more information on Private Network Access and its changes:
- https://developer.chrome.com/blog/private-network-access-preflight/
- https://developer.chrome.com/blog/private-network-access-update/
- https://web.dev/cors-rfc1918-feedback/
Internal only information
This issue was first reported as BUG-3348