CORS Access‐Control‐Allow‐Origin - Serbipunk/notes GitHub Wiki

https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS/Errors

Cross-Origin Resource Sharing (CORS) is a standard that allows a server to relax the same-origin policy. This is used to explicitly allow some cross-origin requests while rejecting others. For example, if a site offers an embeddable service, it may be necessary to relax certain restrictions. Setting up such a CORS configuration isn't necessarily easy and may present some challenges. In these pages, we'll look into some common CORS error messages and how to resolve them.

image

image

https://stackoverflow.com/a/27840082

However, you may be able to prevent this by simply setting:

img.crossOrigin = "Anonymous";

This only works if the remote server sets the following header appropriately:

Access-Control-Allow-Origin "*"

Access to image at 'file:///home/mb/git/js_testfield/canvas/f_ascii_art/im/image1.jpg' from origin 'null' has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, isolated-app, chrome-extension, chrome, https, chrome-untrusted.

solution:

--allow-file-access-from-files

https://stackoverflow.com/a/13262673