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

Prerender EAGERNERSS #436

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

giorgiopellegrino
Copy link

@giorgiopellegrino giorgiopellegrino commented Dec 5, 2024

Hello @addyosmani and @XhmikosR,

I have implemented a key feature for my company that allows prerendering URLs with an eagerness configuration. The fallback is a prefetch triggered on mouseenter when the eagerness property is set to "moderate" or "conservative."

Main changes:

  1. Added functionality to prefetch elements corresponding to the URL upon the mouseenter event.
  2. Added the handling of the eagerness attribute of the script in the speculation rules.
  3. The prerender fallback for devices that do not handle speculation rules has been implemented by adding prefetch, triggered at the mouseenter, if the eagerness mode is ‘moderate’ or ‘conservative’.
  4. All the functions added for prefetch and prerender are available in the listen function to options property, and they will only be executed when elements enter the viewport: options.onlyOnMouseover, options.eagerness
window.addEventListener('load', () => {
  quicklink.listen({el, priority, onlyOnMouseover,
                    prerender, eagerness});
});
quicklink.prefetch(url, isPriority, onlyOnMouseover);
quicklink.prerender(url | [urls], eagerness);

I hope these changes will be appreciated, as they are currently in use across our e-commerce platforms.

Thank you very much.

Giorgio Pellegrino.

cc @gilbertococchi

@giorgiopellegrino giorgiopellegrino changed the title Prerender eagerness Prerender EAGERNERSS Dec 5, 2024
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

Successfully merging this pull request may close these issues.

1 participant