The Importance of Unblocking JavaScript and CSS

Most webmasters have probably received an email from Google telling them they need to unblock JavaScript and CSS . While informing webmasters to allow certain resources on their website is not something uncommon, unblocking JS and CSS is a new warning from Google. This has left many webmasters wondering why it is important for their site enable these files.

The most important reason Google needs to have these resources available is so that websites can be more mobile-friendly. By unblocking JS and CSS, webmasters would actually be helping improve their mobile sites. Rendering these resources to Google also helps Google better identify websites that are using sketchy SEO tactics or highly visible ads and ensure that they are demoted or removed from the rankings.

While Google has warned people about disallowing these two resources for quite some time, many people either ignored these warnings or were just unaware of them until recently. Unfortunately, the email Google sent out was somewhat vague and many webmasters felt it was unclear as to what was being blocked. And while Google provided steps in their email to find the resources that needed to be unblocked, their suggestions seemed quite time consuming. A simpler method to finding the blocked resources is to look under “Blocked Resources” in your Google Search Console. This will be able to inform you what resources need to be unblocked and where they are located.

This can seem a bit overwhelming at first, but there are few key factors you need to focus on when unblocking JS and CSS. Webmasters should note that their homepage is the most important page regarding these resources and it should be your first priority to allow JS and CSS on this webpage. It is also crucial for webmasters to make sure that all resources are unblocked on both the desktop version and mobile version of their website.

Thankfully, once the blocked sources are identified and located, unblocking them should be relatively easy.  In the majority of cases, all you need to do is check the robots.txt and unblock JavaScript and CSS files. And, to make sure these resources are allowed, all you have to do is add the following to your robots.txt file:

User-Agent: Googlebot

Allow: .js

Allow: .css

However, if you area blocking entire directories then you would need to use something like this instead:

User-Agent: Googlebot

Disallow: /deep/

Allow: /deep/*.js

Allow: /deep/*.css

It doesn’t matter how you unblock JS and CSS, all that matters is that you actually do it. By disallowing these two resources you are hindering your website from ranking as high as it could in Google. Unblocking JavaScript and CSS is the easiest SEO fix for your site!