Rocket Loader is a great Cloudflare feature, so why does it recommend turning it off for WordPress?
JavaScript can (and will) slow your site
JavaScript can slow your site. This is for 2 reasons:
- Your site usually uses multiple JavaScript files, and hence JavaScript adds multiple HTTP Requests
- JavaScript is render-blocking. While loading, JavaScript will prevent or slow down the rendering of other page components.
The common, traditional, JavsScript page load optimizations aren’t good enough
On paper, this can be solved by to actions:
- Combining JavaScript assets — for reducing HTTP Requests
- Deferring JavaScript until the page loads — for preventing it to interfere with the rendering of other page components
This is, indeed, a very common optimization. Many plugins offer these features exactly. But as Cloudflare write in an old post from 2011:
Combining Javascript and CSS seems like a sensible solution, but it runs into multiple problems
Combining Javascript & CSS, a Better Way — The Cloudflare Blog
You can read more about them in the original post.
The same goes for JavaScript deferring. SiteGround warns when you click to activate its Deffer Render-blocking JS feature in its SG Optimizer plugin:
Rocket Loader to the rescue
This is why Cloudflare introduced Rocket Loader:
CloudFlare’s approach to reducing HTTP requests is revolutionary. Dubbed “Rocket Loader,” the system automatically detects tags that would require a new HTTP request. Instead of combining the files and leading to the issues above, Rocket Loader instead focuses on combining what really matters for performance: requests.
Combining Javascript & CSS, a Better Way — The Cloudflare Blog
This sounds great. And even better, it is great. I’ve yet to encounter any issues with Rocket Loader. It achieves in a click of a button what other features can’t achieve, even after complex tweaking.
So far so good. But…
Wait, Cloudflare doesn’t want you to use Rocket Loader?
Cloudflare’s WordPress plugin has a button titled “Apply Recommended Cloudflare Settings for WordPress”. Wouldn’t you click it? You would. And you probably wouldn’t notice the button disables Rocket Loader, as it doesn’t announce it.
Not a bug, a feature
This is intentional, as the documentation mention. What the documentation fails to mention is why?
Nowhere else as well could I find the answer. So I decided to ask Cloudflare. After a while (a long while actually) I got this explanation:
There is a known caveat based on the experiences of other customers. Customers using CMS tools like WordPress who edit pages while Rocket Loader is enabled will end up hardcoding the injected Rocket Loader code.
Cloudflare Technical Support Engineer, on “Why applying the recommended Cloudflare settings for WordPress disables Rocket Loader?”
A redundant feature
Frankly, I didn’t quite understand the mentioned issue, but I know I never encountered it. So, as far as my experience, I can conclude that the automatic disabling of Rocket Loader by Cloudflare when applying the recommended Cloudflare settings for WordPress is redundant. A shame, as it is such a great feature.
If you do run into issues, you can always tweak Rocket Loader, as the support engineer mentioned later in his reply.
Conclusion
It seems that Cloudflare’s WordPress plugin turning off Rocket Loader when applying the recommended settings is redundant. You should definitely turn it back on (and test your site, just to be on the safe side).
External links
- What settings are applied when I click “Optimize Cloudflare for WordPress” in Cloudflare’s WordPress plugin? — Cloudflare Help Center
- What does Rocket Loader do? — Cloudflare Help Center
- How can I have Rocket Loader ignore specific JavaScripts? — Cloudflare Help Center
- Combining Javascript & CSS, a Better Way — The Cloudflare Blog