Nội dung
Recently, WordPress Performance Team has just launched an optimized plugin for all WordPress websites called Speculative Loading use technology Speculation Rules API on the browser, helping the website save resources thanks to faster loading when the hovered link will be preloaded into the browser’s cache, through the prefetch or prerendering mechanism that AZDIGI will explain in more detail below. below.
Currently, the feature of preloading the content of hovered links can be supported on some other caching plugins, but the special feature of this plugin is that it uses the browser API and the data will be temporarily saved. on the browser instead of the website server, thereby saving server resources.
How to install Speculative Loading
This plugin can work with any optimization and acceleration plugin without worrying about conflicts, AZDIGI has tested installing this plugin on many different websites and it is still working well.
To install, visit WP-Admin => Plugins => Add New , find the plugin named Speculative Loading and activate it and you’re done.
This plugin does not need to be set up, just activate it and it can work immediately. You can change the type of operation in Prefetch or Prerendering mode in Settings => Reading.
When activated, by default it will select the Prerender mechanism and to see if the website is working, the HTML content will have the following paragraph:
{
"prerender": [
{
"source": "document",
"where": {
"and": [
{
"href_matches": "/blog/*"
},
{
"not": {
"href_matches": [
"/blog/wp-login.php",
"/blog/wp-admin/*"
]
}
},
{
"not": {
"selector_matches": ".no-prerender"
}
}
]
},
"eagerness": "moderate"
}
]
}
This it will do a preload of the entire content being matchedhref_matches
and exclude matchesnot
, so you can see that by default it won’t work on the pagewp-admin
andwp-login.php
.
According to my tests, this plugin works with both logged in and non-logged users. To check, you can log in to the website, then hover over a link and wait about 3 seconds, then click to see the page loaded immediately.
Mechanism of action
Speculation Rules API will operate in 2 types including:
- Prefetch: Preloads the content of the hovered page, but does not include other resources on the page such as Javascript codes, etc. This will help speculation work faster, but users will spend more time when access the target page due to the need to load the resources inside.
- Prerender : Preloads the entire content of the hovered page in a hidden tab of the browser, it will also load all resources inside the page and execute all Javascript code (if any) as if we access a page. complete page. This will be useful for websites that use a lot of Javascript for browser processing, but will consume more memory and bandwidth from the user.
So it can be understood that, choosing Prerender will make speculation work faster, users will almost immediately download the page when it has finished working, but it will require more resources and bandwidth. Therefore, Prerender mode is recommended for regular WordPress websites, but if the website has a lot of content that requires users to manipulate Javascript, you should choose Prefetch mode.
Conclusion
Therefore, as recommended, this plugin can be installed and safely used on any WordPress website to increase website speed better. Also note that, the nature of this plugin will help the website to preload all or part of it when the user hovers over it, and how fast or slow this process will depend on the website’s processing speed when loading a page, so it also You should consider using the services High quality Web Hosting with premium servers for faster loading times.