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

Update request for "quicklink" library to fix CORS errors #419

Open
giorgiopellegrino opened this issue May 6, 2024 · 2 comments
Open

Comments

@giorgiopellegrino
Copy link

Hi @gilbertococchi @addyosmani ,

I am contacting you to ask for an update of the “quicklink” library in order to solve a problem related to CORS errors during resource prefetching.

Specifically, I would like to have the attribute “crossorigin=”anonymous“” added while the prefetch link element is added to the DOM in the “src/prefetch.mjs” file. This is the updated code I would like to implement:

image

The reason for this change is to ensure that prefetched resources are not treated as opaque resources but as cors resources, thus avoiding possible CORS errors when they are retrieved from the cache.

Here is an example of the error that currently occurs when a prefetched resource is called from the cache:

image

Alternatively, one solution might be to allow the user to choose whether to add the “cross-origin” attribute using the API. An example of a call could be:
quicklink.prefetch("URLResource", false, {crossorigin:"anonymous"});

Thank you for your attention and timely resolution of this issue.

Sincerely yours,

Giorgio Pellegrino.

@gilbertococchi
Copy link
Contributor

Hi Giorgio, thanks for opening this issue.

It seems like you would like to personalize the crossorigin attribute of the Fetch or Link=Prefetch tags generated by QuickLink.

Would you be able to open a PR with the suggested code change?
I would be happy to review and provide some suggestions.

Currently the quicklink.prefetch method only support the boolean config isPriority.

It would be required to switch to an option method as you suggested and that may fall as a breaking change.

@giorgiopellegrino
Copy link
Author

Dear @gilbertococchi @addyosmani ,

I would like to inform you that I have processed a pull request (#423).

I would kindly appreciate instructions on any further actions necessary to ensure the validity of the above request.

Thank you.

Giorgio

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

2 participants