In this article
What does it do?
This optimization will improve the following recommendations in PageSpeed:
- Minimize Main thread work
- Total blocking time
- Time to Interactive
- First contentful paint
And may improve other Core Web Vitals as well.
You will find it on the File Optimization tab:
How does it work?
- This optimization is applied only on cached or optimized pages.
- It is enabled by default when you first install and activate WP Rocket
- Combine JS will be disabled when using this option, to ensure scripts are loaded in the correct order
- All scripts that are present in the HTML of the page, will be delayed. Any scripts which are inserted after the page loads, or fetched indirectly from another script, cannot be delayed.
You can find the complete troubleshooting process in the article below:
How to check if delaying is working
- This feature is not compatible with IE 11. Visitors using IE11 will be redirected to an uncached version of the page, with the query string ?nowprocket=1 appended to the URL.
Those URLs will appear to the site's analytics. You can read more about this in our doc.
type="rocketlazyloadscript"attribute will be added. This fake type value prevents the script from being executed by the browser.
- If a script already has a type value, it will be copied in a
data-rocket-typeattribute to be preserved
- The delay script adds a preload for all scripts with a
srcattribute, to make sure they are ready for the user interaction.
- On user interaction, our delay script either removes the fake type, or replaces it with the original one, and the browser executes all scripts.
- The delay script is built to preserve the order and priority of the scripts on the page, taking into account attributes like
- As we discover conflicts, we will maintain a list of automatic exclusions.
- keydown: event is fired when a key is pressed.
- mouseover: event is fired at document (page) when a pointing device (such as a mouse or trackpad) is used to move the cursor onto it.
- touchmove: event is fired when one or more touch points are moved along the touch surface.
- touchstart: event is fired when one or more touch points are placed on the touch surface.