It’s painful when you see your website loading slow, though you have optimized your front-end and the server-side components using the relevant tools and practices. I know how that feels.
What could possibly be the reason, then?
Have you ever given any thought about fixing the render-blocking? Well, this blog will help you with certain useful tips to fix it.
Before jumping in, you need to understand it. Don’t you?.
In easy terms, (Eliminate–remove, Render–layout, design-display webpage, Blocking–stopping) i.e., Render blocking removal.
Every time the browser is loading your web page, the CSS and JS resources also wants to be loaded at first priority before the HTML does. It is default that, CSS is considered as render-blocking resource. Nothing will load until the CSS and JS file loads or parsed. Do you wish to see your page like that?. Heck NO.
Every single CSS and JS files will affect the load time of your page in a huge amount.
But, have you noticed the results in deep, when you put your website’s URL in the pagespeed insights?.
You will find a result section showing the score out of 100 and the exact following statements: (i) Possible Optimizations and (ii) Optimizations Found.
Also, your WordPress websites will be having themes and plugin that adds js and css files to the front-end of your websites. These scripts slows the site load time and also render block of the web page.
Here, Now fix the render blocking CSS
The bigger and the larger CSS files will delay the page load much effectively.
But, at the same time, would you like to see a content that hasn’t been styled? Heck NO.
So, you need some CSS files on the page to display an elegant look Above The Fold (ATF), keeping in mind that, this CSS shouldn’t impede the load time of the page.
Know what ATF is?. In a page, when loaded, the content which you are able to see without scrolling is said as Above The Fold (ATF). The content when you scroll and see, is said to be below the fold.
To discover the exact files that are presently blocking the rendering of your webpage, use the tool “Page Speed insight” developed by Google. This tool will list you the entire files that are blocking a specific page.
Are you aware, what your browser does at the time when your webpage is rendered?
Firstly, the HTML is analyzed and constructs the DOM – Document Object Model. Secondly, the CSS is analyzed and constructs the CSSOM – CSS Object Model. Both DOM and CSSOM are structural representations of HTML and CSS for the better understanding of the browser.
Then comes the render-tree construction, which is nothing but uniting DOM and CSSOM, that suggests and explains the browser about the part to be rendered and how it needs to be appeared and then lastly comes your website display.
Info: when you make an attempt to render a web page without fixing the render-blocking CSS files, the browser downloads all the CSS resources and displays it.
The Critical Rendering Path is nothing but displaying the files in a line, according to the priority it allocates. This happens before the actual display of the webpage by the browser.
Optimizing critical rendering path is very much recommended for the fastest delivery of the first render.
Every single file eliminated makes an impact in the web page speed.
When you consider eliminating render-blocking CSS, you might think as well think of certain parameters relating to the usage of lesser CSS files, (i) By Combining CSS files, (ii) By Inlining the CSS files
(i) By Combining CSS files
Before getting into this, you need to label your CSS, because once you do the labeling efficiently, you are helping to choose only the chosen CSS files and displays without any delay in rendering.
Info: There may be many little CSS files (due to the plugins and widgets), but there will be a main CSS file which is big. If you are into Adsense, then this blog will be a great deal for you.
How do I combine the CSS files?
All you got to do is a simple copy and a paste work.
If you have many CSS files being called, converge it into one CSS file by just copy pasting it in a new CSS file.Let’s assume that you have four CSS files,
You have to open the “CSS2” and copy all the contents in it and paste it into “CSS1”. In a similar fashion do the same for the rest of the CSS files. You will have one main CSS file which is “CSS1” having all the content of the rest of the three CSS files.
After that, make sure you remove the call for “CSS2”, “CSS3”, “CSS4” from your HTML. Now, you will have only one CSS file instead of four. Think the fast your webpage loads when four files got compressed into one.
Statement given by Ilya Grigorik,
“CSS is a render blocking resource. Get it to the client as soon and as quickly as possible to optimize the time to first render”.
(ii) By Inlining the CSS files
Inline itself means inside-lining.
Put your CSS files in an HTML file.
When you do this, you are helping the browser by reducing the number of files to be downloaded before your webpage is displayed. Also, your browser downloads only the HTML file.
How do I Inline CSS files?
You need to do two things:
Copy the entire contents of the external CSS files and paste it in the Head section of your HTML file between the style tags. Make sure you use the right HTML style tags.
Lesser render blocking and quicker loading of your page takes place in this case, as you are not requesting your browser for an individual external file to load to view your CSS file and it saves many trips from the browser to the server.
Again, refer to the discussions we had in the render blocking CSS as well.
The browser has to build the DOM by analyzing the HTML files every time before it renders a webpage. In doing this, if it comes across any scripts, it stops and checks it and then proceeds with analyzing the HTML. This time duration relates directly to the page drag. You need to fix this.
You can identify your page loading issues by using PageSpeedInsight related to render block JS files.
How do I remove Render blocking JS?
There are three ways.
(i) By the use of Inline JS
(ii) Making JS Asynchronous
(iii) Defer loading of JS
If you are using jQuery before the initial render and below the fold, then there won’t be any necessity for it to load unless there is a cause.
But if you are using it above the fold, then it goes without saying that you aren’t going by the rules of the regulations and guidelines of what the pagespeed says. In this case, you will have to look in for the HTML file and change where the jQuery’s call is made.
(i) By the use of Inline JS
You should have a lean JS file. Render blocking scripts pushes the browser to halt until they are being downloaded and many round trips for rendering the same.
In the case you having a lean JS file, then you can inline the contents of the JS file in the HTML file and prevent the delay in the page display and quickens the initial render.
By doing this, you need to take care of the HTML file size too.
(ii) Making JS Asynchronous
Why do this? You might have known that, the JS by default stops building DOM and ends up by delaying the time duration for the initial render.
Try using the below script in your HTML,
<script async src=”my.js”>
The following takes place when you use it,
The Asynchronoused scripts are downloaded by the browser
During this process, the browser does not stop for analyzing and or any building of the DOM in the middle. Also, any other scripts needed by the site is not prevented by this process. Until this script is done downloading, the browser not rests for any other actions.
(iii) Defer loading of JS
In simple terms, you can separate the scripts which does not have any impact on your above your fold content, for the initial render and they may be deferred until after the first render or all the important part of the webpage is loaded. This way, resource contention can be reduced and for the performance enhancement.
Always have a concern about the WordPress themes and plugins you are installing, as they use CSS and JS which might be a challenge when it comes to render blocking removal.
Remember, if your webpage calls anything, then it seems to drag your load time.
jQuery forms a pretty good example in this case.
Based on the discussions, reducing the files and inlining them makes the file shrink and does the same work in a faster way which is what is needed for rendering.
Almost all the websites are facing the problem of rendering block. But the question is how to remove them. By following all the useful tips given above, you can easily boost up your load speed of your webpage, though you have done front-end optimization through ideal tools like pagespeed insights and SpeedBoost.
So, I believe you will find this blog useful.
I have suggested you from my experience and knowledge. In a similar fashion you might have come across several experiences which is worth.
Share your ideas and the tips you feel which we missed in the comment section.
Congratulations on selecting the right CMS and with millions of global WordPress users you have made the right choice! Ease of use and ‘seamless integration’ with third party plug-ins help WordPress thrive as the CMS leader. When you know the ground rules, it makes your life easier and helps your business to grow. We at WebSpeedMaster are living with WordPress since its birth and our expertise with it helps us deep dive with insights on how it works and how it should be handled in better ways to benefit businesses.
The best features are easy plug-ins and sometime it turns to be nightmare when you end up with the wrong plug-ins. So we wanted to take this up, share our experiences and would like to put up some useful notes.
Probably you have also followed all common trends and spiced up your website with awesome Word press plug-ins that offer helpful features like – auto backup , contact forms, for security, Google analytics integration, Search Engine Optimization (SEO) to name a few basic ones among the vast ocean of plug-ins, some free and others at a premium price.
As a smart knowledgeable online e-business entrepreneur, you already know that-
However did you know you could be losing customers due to “Word press Plug-ins” slowing down your website?
YES! Let us take a look at the real picture and see how these guidelines could help you.
Word press plug-ins has its advantages with ease of use but they also slow down the loading of your websites. For instance, so called ‘speed up plug-ins’ are usually built to increase your PageSpeed/YSlow score, or the pingdom score but in reality they leave us with slow loading sites.
So what are the reasons for Word press Plug-ins slowing down the websites?
1. Choice of Plug-ins
Your choice of plug-ins can be a common cause. Plug-ins, are written by different developers with highly varying skill sets. Plug-ins with poor coding creates slow performance issues. Free Plug-ins does not get updated periodically, slow down sites, or are not supported and also are prone to be hacked. So you have to be very careful on what is installed and how many are installed. The rule of thumb is “Less plug-ins is best”.
You can choose high quality plug-ins if available for the feature or preferably use custom code to enable more control on the code and functionality to improve site performance.
Here are some useful tips we recommend to help you choose the right WordPress plug-ins
- Check for plug-ins with good reviews along with a 4 star or higher rating coupled with positive user experience from the community.
- Compatibility of the selected plug-ins with recent version of WordPress or your specific theme is a core issue as WordPress changes rapidly and can lead to strange errors in the website. (Warning will say : “This plugin has not been tested with your current version of WordPress.”)
- Always refer to the last updated date. Probably there should be an update at least on last 4-6 months else it could imply abandonment of development or support of the plugin.
2. Too many Plug-ins
The more plug-ins you use makes sites slow as the browser has to load more code which is not streamlined with your website code or themes. Plug-ins can conflict with each other slowing the site. Simpler codebase sites load faster than complex ones.
You should reduce number of plug-ins and add custom codes for the functionality that will be streamlined with your website code or themes.
3. Plug-ins loading too many scripts
You have a Custom code options that can stop plug-ins from loading certain things altogether like – specify when the file is to be loaded, load assets asynchronously (controlling the timing of operations) and other techniques.
4. Overdose of database queries
Plug-ins that has multiple database queries inbuilt to serve the complex functionalities may store values in database every time a page is loaded – which means additional multiple database requests for the number of times the page is loaded.
You could try finding an alternate plug-in that makes fewer database calls or use custom code to reduce queries to the database, or cut down frequency of queries or kill specific database queries which help in saving processing power besides speeding your website.
5. Plug-ins performing complex operations
Complexity in plug-ins involves activities like querying large size data or actions with data which all impacts site speed performance. Queries become problematic with increasing data size which over time can slow the site or some functions drastically.
You could better have these types of complex operations off the word press hosting environment or optimize complex functions with custom code.
6. Plug-ins performing remote requests
Some plug-ins perform requests to external API’s from third party services. Running external requests impact the website performance.
Using custom code to optimize and prevent remote requests every time the page loads will save time and effectively load the site.
Alternatives to plug-ins Setting aside the ease of adding plug-ins, if the quality of code is poor, your site will take more time to load. Using manual codes is better than plug-ins. A good example would be – instead of using the hugely popular ‘Yet Another Related Posts Plug-in’ (YARRP), using custom codes to show ‘related posts’ would make it much simpler and faster.
Let us look at a popular plug-in like Lazyload.
Lazyload plugin case study
Lazy load plug-ins is used to improve page load times by delaying the loading of images till it is in the viewport (web page part that the user can currently see). Images bring life to the site in displaying graphics or products the customer would like to buy. However unless you check the compatibility of the theme code and plug-ins or with the users browser, you could be losing customers views and opportunities for sales. Mobile and tablet devices many times do not trigger lazy loading events unless the user has scrolled the full page. Let us look at an example below.
At the surface, you may or may not have realized the complexity in Word press Plug-ins and the impacts to your sites loading speeds as elaborated above. We at WebSpeedMaster can help you to speed up your website with optimal custom coding solutions and remove the plug-ins bottlenecks.
Our highly experienced and skilled technical consultants can help improve loading speed by reducing the number of plug-ins yet have the desired functionality with high quality coding that amalgamates with your website codes or themes and prevents the site speed bottlenecks by readymade plug-ins.