Easily Defer Render Blocking Resources

The Easiest Way to Defer Render Blocking Resources

Let’s be honest, there is so much different information out there on how to speed up your site and get a super high Google PageSpeed score.

We’ve looked at it all, and trust me when I say this, it can be overwhelming, and sometimes frustrating, looking through all that information, wondering where t

o begin.

But we’ve been able to sort the wheat from the chaff, and boil it down to the easiest way to defer render blocking resources, such as CSS and Javascript, in your web pages.

For your entire site.

All at once.

I know, I know, seems to good to be true, right?

Well, I thought so too when we first doing our research.  Could we, where no one else seems to have before us, come up with a solution that makes deferring render blocking resources easy?  For an entire website?

The answer is, absolutely.

You see, there’s a bit of a trick involved.  One that we will share with you.

But first, I’ll describe it is traditionally done.

First you should understand that there are three methods to loading javascript into a page.  The trouble is, “vanilla” and “asynchronous” are still considered blocking calls, because they pause the HTML parser to execute (and load in the case of the non-asynchronous method).  This is a big no-no when it comes to getting your pages to render ASAP.

The third option, deferring the script, is the preferred method, when Google wants you to have the HTML rendered first.  So in this case, you either add the “defer” attribute to your script tags, or you move them all to the bottom of your pages.  The big problem with this, however, is that if there is any “inline” script in your pages that depends on the loading of any of those “deferred” scripts, the inline script won’t execute and will throw an error.  An inline script looks like this:

<script>
jQuery(“#someid”).doSomething();
</script>

Because the “jQuery” library is deferred to the bottom of the page, this script won’t execute properly.

So traditionally, in this situation, the solution is to put all of your javascript into a single long file, that loads once, at the end of your page, in the order it needs to execute.   This is time consuming to do, and what if you have different scripts on different pages.  Then does that mean you need to have a different ginormous scripts load for each page?

In any case, it takes time, a lot of time, to do each page.  But not with our trick.

With CSS, the preferred method to load the stylsheet references these days is to use loadCSS, which is a function for loading CSS asynchronously.  It’s pretty easy to implement, but if you have to do your entire site, it can take a fair bit of time to go page by page and convert all of your CSS references to the bottom of the page.

And then, with loadCSS, you still have the problem of the Flash of Unstyled Content (or “FOUC”) where you get a blank white page for a second or so until the stylesheets load and render.

So, the traditional method is both time consuming and clumsy.

That is where our trick comes in to play.

You see, we developed a handy-dandy tool called Accelerator.  Accelerator looks at all of the recommendations that Google PageSpeed Insights suggests and programmatically implements them, to your web pages, instantly, and on the fly, when a page is requested by a web browser.

So think of it like this: You upload a traditional web page, completely un-optimized, to your website.  You load it in your browser, but instead of scoring a 24% with Google PageSpeed, you score 94% (or higher even)!

What Accelerator does is it sits there waiting for a page to be requested.  When a web browser requests a page, Accelerator steps in and instantly moves your Javascript and CSS references around to the proper places, puts the proper attributes where they need to be, and calculates the “critical, above the fold CSS” to avoid the Flash of Unstyled Content, and serves that page to the web browser.

Seriously!  I know, right?  It just does it!

Think of Accelerator as a personal attendant that straightens your attire, does your hair, plucks your eyebrows (if you need that sort of thing) before heading out on a big date.  It makes you look awesome, without having to change a thing in your web pages.

And it only takes a few minutes to get installed to your server.  After that, you just sit back and think of all the time (and headaches) you just saved.

It really couldn’t be easier.

Learn more about Accelerator, and all of the other ridiculously cool things it does, by heading over to i3dTHEMES.