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

Add corssorigin support #613

Open
RhinoLance opened this issue May 29, 2024 · 0 comments
Open

Add corssorigin support #613

RhinoLance opened this issue May 29, 2024 · 0 comments
Labels

Comments

@RhinoLance
Copy link

RhinoLance commented May 29, 2024

This relates to applications that have the following header set: "Cross-Origin-Opener-Policy": "same-origin"

In such instances, any remote images need to have the "crossorigin" attribute added to the "img" tag.

What is the expected behavior?

The images load in the gallery

What is the current behavior?

Images don't load, with the following error:
ERR_BLOCKED_BY_RESPONSE.NotSameOriginAfterDefaultedToSameOriginByCoep

What are the steps to reproduce?

Add the following headers in angular.json under projects - app - architect - options:

"headers": {
"Cross-Origin-Opener-Policy": "same-origin",
"Cross-Origin-Embedder-Policy": "require-corp"
}

What is the use-case or motivation for changing an existing behavior?

The only way to use this component in such an environment at the moment is to use a custom templates in order to add the crossorigin attribute:

<gallery id="gallery" <ng-container *galleryItemDef="let item; let type = type"> <img crossorigin galleryImage [src]="item.src"> </ng-container> <ng-container *galleryThumbDef="let item; let type = type"> <img crossorigin galleryImage [src]="item.src"> </ng-container> </gallery>

Which versions are you using for the following packages?

Angular: 18.0.0
Angular CDK: 18.0.1
Angular CLI: 18.0.1
Typescript: 5.4.5
Gallery: 11.0.0

Is there anything else we should know?

Further information abour CORS support for html elements can be found at https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_enabled_image

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

No branches or pull requests

2 participants