Skip to content
New issue

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

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

Already on GitHub? # to your account

Add crossorigin=anonymous to nomodule scripts the same as module ones #1194

Conversation

westonruter
Copy link
Member

When reviewing the output of the RewriteAmpUrls transformer, I noticed that the nomodule scripts lacked the crossorigin=anonymous attribute like the the module scripts did. This makes them consistent.

Aside: It seems to be that there should also be a transformer config option for whether crossorigin=anonymous should be added in the first place. Sure it should be added by default, but for some use cases it is not good to add, namely when you are wanting to opt-in to beta/experimental channels via cookie (cf. ampproject/amp-wp#4600). Nevertheless, for this to be feasible the validator would need to make crossorigin=anonymous non-mandatory for the modulepreload link and all module scripts. I assume the cookie-based opt-in works for modules.

Copy link
Collaborator

@sebastianbenz sebastianbenz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@sebastianbenz
Copy link
Collaborator

I replicated the behaviour of the AMP cache here. Not sure what the original intention was to omit it for nomodule.

@sebastianbenz sebastianbenz merged commit 1fc78d5 into ampproject:main Apr 9, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants