Enable CORS on Chrome for Testing in Browser Print

Anonymous (not verified) -
1 MIN READ
460

Recently, we received reports from the developers in our community about the examples in Browser Print​ not working with Chrome browser.  They reported that the examples work just fine with Safari, Internet Explorer and Firefox browsers, but not with Chrome browser. When launching the index.html (from C:\Program Files (x86)\Zebra Technologies\Zebra Browser Print\ZebraBrowserPrintDocsWebCodeExamples\sample\ folder) in Chrome, they got an error message like below in Chrome.

Chrome.JPG

We looked into this issue and found that recently Chrome browser has disallowed the cross-origin access. To make the examples in Browser Print​ work with Chrome browser, we need to enable cross-origin resource sharing. One method to do this is to install an extension, such as the Allow-Control-Allow-Origin​. Once the extension is installed in Chrome browser, we will see an icon on the right side of the address bar. We can enable or disable the cross-origin resource sharing by clicking on the radio button.

Chrome2.png

Please also note that we recommend to disable the cross-original resource sharing after testing, because adding the Allow-Control-Allow-Origin to enable CORS on Chrome will disable a built-in security feature of Chrome browser on all sites. If we forget to disable the cross-original resource sharing, we may expose potential security vulnerability. Please remember to disable the extension after the testing on Chrome.

Hope this helps. Happy coding with Browser Print​.

profile

Anonymous (not verified)

Please Register or Login to post a reply

Replies