-
Notifications
You must be signed in to change notification settings - Fork 407
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
Added CROSSORIGIN and eagerness PRERENDER #434
Conversation
src/prefetch.mjs
Outdated
// TODO: Investigate using preload for high-priority | ||
// fetches. May have to sniff file-extension to provide | ||
// valid 'as' values. In the future, we may be able to | ||
// use Priority Hints here. | ||
// | ||
// As of 2018, fetch() is high-priority in Chrome | ||
// and medium-priority in Safari. | ||
return window.fetch ? fetch(url, {credentials: 'include'}) : viaXHR(url); | ||
options = {headers: {accept: '*/*'}}; |
Check warning
Code scanning / CodeQL
Missing variable declaration Warning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated the declaration for the variable, defining it as a constant using the const keyword.
Hello @addyosmani , I noticed that the code in the pull request did not pass the size limit test. Could you consider increass the size limits? The increase in resource size is due to the introduction of new arguments and parameters. Thank you, |
Hello @addyosmani and @XhmikosR, Prefetch
Prerender
ListenAll the functions added for prefetch and prerender are available in the options property, and they will only be executed when elements enter the viewport: Usage
To accommodate these functionalities, the size of the compiled modules has increased. Consequently, I have updated the limits in the I hope these changes will be appreciated, as they are currently in use across our e-commerce platforms. The code is ready for validation. Could you please proceed with the review? Thank you very much. Giorgio Pellegrino. |
Hello, I have split the ticket into two separate pull requests to make it easier to review and verify. Below are the links to the pull requests:
For this reason, I will proceed with closing this ticket to avoid duplication. cc. @gilbertococchi Thank you. Giorgio Pellegrino |
Dear @addyosmani @XhmikosR ,
I am submitting this pull request to address issues encountered within our Luxottica e-commerce group, where we observed inconsistent resource prefetching behavior across different browsers.
Currently, three prefetching methods are implemented:
Access-Control-Allow-Origin
header, using the attributecrossorigin="anonymous"
.Access-Control-Allow-Credentials
response header.mode: "cors"
and checksAccess-Control-Allow-Origin
, whilecredentials: "include"
ensuresAccess-Control-Allow-Credentials
validation.Additionally, I have handled resource prioritization for Safari devices, adding the
priority: "low|high"
property specifically for fetch requests. All parameters are set tofalse
by default but can be adjusted as needed.The updated method signature for prefetching is as follows:
I would appreciate your review of these improvements.
Thank you,
Giorgio
c.c. @gilbertococchi