Screpy - AI SEO Audit Tool

Reducing Render-Blocking Resources

In order for your website to work properly, you need to get rid of URLs that hamper the rendering process. Here are a few tips for you!

Reviewed by Screpy Editorial Team

Screpy page speed audit flags and lists the URLs it detects are render-blocking for you. The list is as follows:

reducing render-blocking resources

Which URLs are considered as render-blocking resources and flagged by Google Lighthouse?

Detailed scanning studies of the Google Lighthouse platform have detected two types of render blocking resources. The first of these are scripts. The second is the style sheets.

Among the <script>tags marked as render-blocking resources are:

  1. Under the head tag of the document
  2. Those who don’t have the Defer attribute
  3. Those who do not have the async attribute

Among the <link rel="stylesheet">tags marked as render-blocking resources are:

  1. Those that do not have a disabled attribute. If the tag in question has this type of attribute, the behavior of the search engine will change. In such a situation, the search engine may have a problem downloading the stylesheet.
  2. Those who don’t have a media attribute. If there is no media attribute owned or the existing option does not match the user’s device, a similar problem will occur.

Identifying critical resources

After detecting render-blocking resources, what you need to do is to mitigate them. For this, it is necessary to determine which problems are critical and which are not. For that, use Chrome DevTools and go to the Coverage tab. On this tab, you can discover non-critical CSS and Js and decide what you want to edit.

Use this tab when you want to load a page or when a page is running. Tab gives you information about how many codes are used in real-time. It also tells you how many have been loaded. In this way, you get a chance to compare and easily notice the codes that prevent rendering. Let’s examine an example of the audit report:

chrome devtools

It’s obvious what you need to do in order to minify the size of your pages. You have to ship what you need among the code and styles. When you come to this page, click on the URL of your choice and easily review that file. You will see that the styles inside the CSS files are marked with two colors. The same is true for codes in Javascript files:

  1. Green colors indicate critical situations. These contain the styles that are absolutely necessary for the first paint. The basic functions of your web page are also supported by them.
  2. Red colors indicate non-critical situations. These codes are not used for basic functions within the page.

How to pass the audit? – Eliminating render-blocking scripts

Have you decided which critical codes are? Now is the time to move the URL preventing this code from running. In this way, the page can be loaded easily.

If there is some non-critical code in the render-blocking URL, you can opt-out of deleting the URL if you wish. A good solution would be to replace the URL using the async or defer attributes instead.

But if you are not using the code in question at all, you should definitely remove it. For this, you can see our remove unused code article.

How to pass the audit? – Eliminating render-blocking style sheets

Way 1: We know that there is an inlining code inside the script tag. Similarly, inline critical styles may be required for first paint in a style block located in the head of an HTML page. All you have to do is load the remaining styles. But be careful about doing it asynchronously and using the preload link.

Way 2: There is one more way to completely reduce render-blocking styles. For this, you need to take these styles and split them into several different files. Each file can be organized by a media query. You will then need to add a media attribute for each stylesheet link. Once you do this, you will see that the browser is blocking the initial paint.

Way 3: Another thing you can do is minify the CSS. As we mentioned before, there can be many ways to do this. But it is enough to remove unnecessary white spaces or unnecessary code and characters in the file. In this way, your users receive a small package instead of a large file.

Remove blocking work without breaking the first render.

Start with the URLs reported on the affected page, decide whether each resource is critical, and change its loading strategy only after confirming what it provides.

  • Record each blocking stylesheet or script, its transfer size, initiator, and whether above-the-fold content depends on it.
  • Inline only small critical CSS; defer noncritical styles and scripts while preserving their execution order.
  • Retest the first render, interactions, console, and network waterfall under the same mobile conditions.

How to diagnose it

  • Use the network waterfall and coverage data to separate critical resources from files that are merely discovered early.
  • Trace bundled files back to the component or third-party feature that loads them before changing async or defer attributes.

How to fix it

  • Keep the minimal CSS needed for above-the-fold content available immediately and load the remaining stylesheet after the critical path.
  • Use defer for dependent page scripts and async only for independent scripts whose execution order does not matter.

How to verify the fix

  • Run the same mobile performance test more than once and compare the median render metrics and blocking-resource list.
  • Hard-reload the page and test navigation, consent tools, analytics, forms, and content that appears after interaction.

Limits and false positives

  • A small critical stylesheet may be correctly render-blocking; removing it can create a flash of unstyled content and worsen perceived performance.
  • Preload changes priority but does not make a stylesheet nonblocking, and excessive preloads can delay more important resources.

Before

<script src="reviews.js"></script>

After

<script src="reviews.js" defer></script>

Related tasks

Heading Order: Fix Skipped Heading Levels

Use a logical H1-H6 hierarchy so people and assistive technology can understand page structure. Learn how to find and fix skipped heading levels.

Thursday, November 12, 2020

Reduce Excessive DOM Size

Statements made by Google underline one point: Document Object Model AKA web page should not be on excessive size.

Tuesday, October 27, 2020