Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access-Control-Allow-Origin mission on image requests #192

Open
morwoen opened this issue Jun 7, 2021 · 3 comments
Open

Access-Control-Allow-Origin mission on image requests #192

morwoen opened this issue Jun 7, 2021 · 3 comments

Comments

@morwoen
Copy link

morwoen commented Jun 7, 2021

When an image is requested through an API call rather than through an image tag on the page the browser blocks the request due to missing Access-Control-Allow-Origin. I am using the API in a Unity game embedding the WebGL player in a website.

I would gladly contribute to the API but failed to find where the current header is set to move it to apply to images as well 😅

@MattyDub
Copy link

I'm also seeing this issue. Was it ever addressed?

I'm trying to load an image like:

<img class="user-image" alt="User portrait" crossorigin="" src="https://randomuser.me/api/portraits/thumb/women/65.jpg" referrerpolicy="no-referrer">

...and my browser dev tools return a "CORS missing allow origin" message.

@Souvlaki42
Copy link

I had a similar problem with Access-Control-Allow-Origin. I solved it by adding the mode: "cors" and credentials: "omit" options to the request method. Can you try that please?

@MattyDub
Copy link

MattyDub commented Sep 9, 2022

I was also able to get it to work. I was just using elements, and the fix for me was to remove the cors-related attributes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants