Google says it’s normal for cached JavaScript pages to appear empty

JavaScript-based web pages may appear empty or incomplete in Google’s cache, which is normal and does not indicate a problem.

So says Google’s Search Advocate, John Mueller, in the latest installment of the Ask Googlebot video series on YouTube.

A question is submitted by someone asking why their JavaScript pages are not showing up in Google’s cached view.

The question reads as follows:

“The cached version of React pages shows a blank page. What parameters should be taken into account when coding React pages with SSR to make them compatible with Googlebot? »

A cached page is a snapshot of what the URL looked like the last time it was crawled by Googlebot.

When a cached page appears empty or has missing content, it’s natural to suspect that Googlebot has encountered a problem while crawling. But it’s not always the case.

As Mueller explains, Google’s cache only captures the HTML elements of a page.

It’s not that Google isn’t able to cache JavaScript, it’s more that Google is held back by browser restrictions.

Google cache only shows HTML

Caching JavaScript-based web pages is a challenge, Mueller says.

Not from a technical point of view, but rather from a security point of view.

Web browsers have restrictions on accessing content and may block requests for JavaScript files when they come from other websites (like Google’s cache).

Google Search sometimes keeps a copy of the HTML page pulled from a server and shows it to users as a cached page. It is, however, really just the HTML page.

For JavaScript-based websites, it gets a bit tricky here. Due to browser security, there are restrictions on how content can be accessed from a page.

For example, if a page needs a JavaScript file from your server, browsers can block that request when it comes from other websites. In our case, the other website would be Google’s cache.

In practice, this means that JavaScript-based websites often display an empty or incomplete page when viewed from Google’s cache. This is normal and not a sign of a problem.

While an empty page in Google’s cache can be daunting, what really matters for search is how the page is indexed.

To be sure, Google can treat JavaScript separately and will try to index the page as users see it.

Muller continues:

“In particular, for indexing, Google will treat the JavaScript separately and try to index what a user would see when visiting your website directly. This rendered version of a page is visible in Google’s testing tools Search Console if you want to check.

In most cases, Google can correctly display and index content from JavaScript-based websites. So, in short, it is normal for a JavaScript website’s cache view to be empty or incomplete. This is not an indication of a problem, it is just a technical restriction in browsers.

For a more accurate picture of how Google views your web pages, use the URL Inspection tool in Search Console.


Featured image: YouTube.com/GoogleSearchCentral, April 2022.

Comments are closed.