SEO Blog - Resources - seoClarity

JavaScript and Google Indexation: Test Results Reveal What Works for Search

Written by Jeff Reynolds | April 15, 2022

Google has made a concerted effort to treat JavaScript content just like plain old HTML over the past few years.

The search engine updated the Googlebot crawler to the latest version of Chrome to give it the same capabilities as the Chrome browser so that it can read and understand JavaScript.

Not only that, Google continues to improve their parsing performance so that JavaScript-rendered content can be understood and displayed in SERPs almost as quickly as plain HTML  — and they continue to update information on the Google developer website.  

We tested Google’s JavaScript capability using a new feature in the seoClarity platform that allows updates to quickly be made to web pages.

JavaScript FAQ: SEO Results

Does JavaScript work for SEO?

The short answer is, yes! Both Google and Bing have increased their ability to understand JavaScript content.

How can you tell if Google renders the JavaScript on a page?

Using Google Search Console URL Inspect, you can fetch and render the changes immediately. Google offers detailed and frequently updated documentation on JavaScript.

Recommended Reading: Dynamic Rendering and SEO: How to Help Search Engines (and Users) on Your Website

What will Google actually index, rank, and display in the SERPs?

Google will pick up and display your titles, meta descriptions, H1, content, links, FAQ, and more.

Here are a few more detailed examples … 

Does Google index page titles rendered using JavaScript?

Yes. We tested title tags replaced by JavaScript-generated text and found those titles via search in the Google SERP.

Google, however, still has a tendency to rewrite them to better match the user’s query.

Recommended Reading: Optimize AngularJS SEO for Crawling and Indexing Purposes

Will Google display the meta description as a snippet if it is written using JavaScript?

Yes. We tested meta descriptions replaced by JavaScript generated text and found those as snippets in Google search results. Like page titles, Google sometimes rewrites them to match a user’s query.

Are H1 tags updated by JavaScript index by Google like HTML?

Absolutely! We have a client that was impacted by Google title rewrites, where terms that were important for CTR were removed.

Using JavaScript updates to their existing H1 tags, they were able to get those terms back into the Google rewritten versions of their SERP titles.

Will Google index and rank JavaScript content added to a page?

Yes. We placed text using JavaScript on product category pages to increase relevance. And, we even replaced the entire body of a web page with JavaScript generated content and found those pages via Google search querying for terms within the new content.

Will Googlebot follow JavaScript rendered links?

Yes. Google treats these links just as it would links in HTML. To test this, we created a series of pages, all linking to the next page via JavaScript-generated links.

In this test, we created a hierarchy of 5 pages and the only links to them came from our initial test page, then each linked to the deeper page.

It took a few weeks, but all of these pages were found in the Google index, ranking for unique text contained on the page.

Will Google index and rank lazy-loaded content?

Yes — and even extremely lazy-loaded content. We tested loading content on a 5 second delay, then updated that content via JavaScript.

We found that Google chose to display the updated content as the Google snippet. We’re currently testing just how lazy the text can be. Stay tuned for those results!

Will Google treat JavaScript-generated FAQ schema just like it was manually coded?

Yes, quite well. Structured data generated using JavaScript appeared within 7 days for a website already ranking for their top keyword.

Does Google honor directives in meta robots tags rendered with JavaScript instead of the source code?

Yes. In our tests we published pages and allowed them to live in the Google index for a month. Then, we created a meta robots tag to “no index” the pages.

Within a week of their next crawl, the pages disappeared from the index and have not reappeared after several weeks.

How long does it take for changes to appear?

Changes appear on an average of 5 days once crawled.

Isn’t JavaScript rendered content considered cloaking, since it is different from the HTML source code?

Not at all. Cloaking is a sneaky tactic where you show the search engine bot a different version of the page that you show to users. In all of our use cases, we show the exact same content to both the users and search engine bots.

Conclusion

We have more tests in progress, as we strive to test the limits of the ever-increasing capabilities of Google and other search engines. Check back often or subscribe below to get the latest results.