It’s normal for JavaScript-based webpages to appear empty in Google’s cached view, says Google’s Search Advocate John Mueller.
JavaScript-based webpages may appear blank or incomplete in Google’s cache, which is normal and not indicative of any problems.
This is stated by Google’s Search Advocate John Mueller in the latest installment of the Ask Googlebot video series on YouTube.
A question is submitted by an individual asking why their JavaScript pages aren’t showing in Google’s cached view.
The question reads:
“The cached version of React pages shows a blank page. What parameters should be considered while coding the React pages with SSR to make them Googlebot friendly?”
A cached page is a snapshot of what the URL looked like the last time it was crawled by Googlebot.
When a cached page looks like it’s empty, or is missing content, it’s natural to think Googlebot ran into a problem when crawling it. But that’s not always the case.
As Mueller explains, Google’s cache only captures the HTML elements on a page.
It’s not that Google isn’t capable of caching JavaScript, it’s more that Google is held back by browser restrictions.
Google’s Cache Displays HTML Only
Caching JavaScript-based webpages is challenging, Mueller says.
Not from a technical standpoint, but rather from security standpoint.
Web browsers have restrictions on how content can be accessed, 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 that was fetched from a server and shows that to users in the form of a cached page. That is, however, really just the HTML page.
For JavaScript-based websites it gets a little bit complicated here. Because of 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 may block that request when it comes from other websites. In our case, the other website would be Google’s cache.
In practice, this means JavaScript-based websites often show an empty or an incomplete page when they’re shown from Google’s cache. This is normal and not a sign of a problem.”
While an empty page in Google’s cache may be discouraging, what really matters for search is how the page gets indexed.
To be sure, Google can process JavaScript separately and will try to index the page as users see it.
Mueller continues:
“In particular, for indexing, Google will process the JavaScript separately and try to index what a user would see when they visit your website directly. This rendered version of a page is visible in Google Search Console’s testing tools if you want to double check.
For the most part, Google can render and index content on JavaScript-based websites fine. So, in short, it’s normal that the cache view of a JavaScript website is empty or incomplete. That’s not an indication of a problem, it’s just a technical restriction in browsers.”