The delay occurs due to Ajax loading, where the page initially loads from the cache, and dynamic content is rendered only after the page finishes loading. This process is necessary when utilizing both page caching and dynamic content.
The page cache is actually a ‘snapshot’ of the page that is being served to the user. Dynamic content, which changes based on the user, needs to be loaded separately.
A straightforward solution is to exclude the page from the cache and load the dynamic content without Ajax.
Loading a specific trigger without Ajax can be achieved by simply adding the parameter “ajax=”no” to the trigger’s shortcode.
Nonetheless, this approach involves a tradeoff between page cache utilization and dynamic content functionality. When making the decision there are two factors that are worth to consider:
1. The loading speed of the page without page cache.
2. The importance of the page for SEO, including its ranking and potential to rank higher.
If excluding the page from the cache is not an option, you can explore the following solutions to optimize the dealy:
If-So offers three options:
In many cases, displaying default content can be an optimal solution, particularly when the size of the default content closely matches that of the dynamic content. For instance, if the dynamic content is a button and the size of both the default and dynamic buttons is similar, users may hardly notice the content change.
More information about the animated loader option and instructions on how to set it up.