Skip to the indexed answers
Digital Marketing Index

usdigitalmarketingindex.com SEO

How can you check whether Googlebot sees text generated after JavaScript executes?

Compare two versions of the page: the HTML the server sends, and the HTML that exists after scripts have run, as Google’s own tools report it. If the text appears in the rendered HTML shown by the URL Inspection tool in Search Console, Google’s renderer produced it. If it appears only in your browser and not there, something stopped it: a blocked script, a failed request, content that waits for a user action, or a delay. Google does render JavaScript. Its documentation says it uses “the rendered HTML to index the page” (Google’s JavaScript SEO basics). The check is whether your particular text makes it into that rendered HTML.

Initial HTML versus rendered HTML

Google’s documentation describes three phases for JavaScript pages: crawling, rendering, and indexing. In the first, Googlebot fetches the URL and receives the server’s HTML. Later, “a headless Chromium renders the page and executes the JavaScript”. The page “may stay on this queue for a few seconds, but it can take longer than that”.

Sample markup that depends on the second phase:

<!doctype html>
<html lang="en">
<head>
  <title>Trail running shoes</title>
</head>
<body>
  <h1>Trail running shoes</h1>
  <div id="description"></div>
  <script>
    document.getElementById('description').textContent =
      'Shoes with deep lugs and rock plates for uneven ground.';
  </script>
</body>
</html>

The served HTML contains an empty description element. The sentence exists only after the script runs.

To see the served HTML, view the page source in a browser, or fetch the page from the command line without executing scripts:

$ curl -s https://www.example.com/trail-running-shoes/

Read the description element in that output. In the served HTML it is empty, and the sentence appears only as a string inside the script. The browser’s element inspector shows the rendered document, where the element is filled.

URL Inspection rendering

Search Console’s URL Inspection tool reports what Google’s renderer produced.

  1. Inspect the URL and run a live test.
  2. Open the tested page view and select the HTML tab. This is the rendered HTML.
  3. Search it for a distinctive phrase from the generated text.
  4. Check the screenshot for a visual confirmation.
  5. Read the list of page resources that could not be loaded, and the JavaScript console messages.

Two notes on reading the result. The view of the indexed version, shown without a live test, reflects the last crawl, not the current page. And the screenshot is available only in a live test.

Blocked resources and delayed data

When generated text is missing from the rendered HTML, look at five causes.

Cause How to recognize it Fix
Script or data blocked by robots.txt Listed under resources that could not be loaded Allow the file. Google's documentation says it "won't render JavaScript from blocked files or on blocked pages"
A request the script depends on fails Console errors; an API returning an error to the renderer Make the endpoint reachable without login or special headers
Content waits for a user action Text appears only after a click, scroll, or hover Load it without the action
Content arrives late Text appears in the browser after several seconds Render it sooner, or on the server
Script error in the renderer's browser version Console error in the live test Fix or transpile the code

On the third row, Google’s guidance on lazy loading states that “Google Search does not interact with your page” (Google’s guidance on lazy-loaded content), and its pagination guidance says its crawlers do not click buttons. On the fourth, Google’s JavaScript documentation gives no figure for how long the renderer waits, so a test that passes with a slow response today is not a guarantee.

Proof and limitations

A comparison checklist for one page:

Check Tool Pass condition
Text in served HTML View source, or a fetch without scripts Present, or knowingly absent
Text in rendered HTML URL Inspection, live test, HTML tab Present
Text in screenshot URL Inspection, live test Visible
Resources loaded URL Inspection, page resources None of the needed files blocked or failed
Console URL Inspection, JavaScript console messages No errors affecting the content
Indexed version URL Inspection without live test, after recrawl Text present in the crawled page HTML
Search Search for an exact sentence from the generated text in quotation marks The page is returned

The last two rows are the proof that matters. A live test shows that rendering can work now. The indexed version and the quoted search show that it did.

Limits to state with any conclusion:

  • The live test and the indexing pipeline are not identical runs. A pass in one is strong evidence, not certainty, about the other.
  • Results are per URL. A template that works on one page can fail on another whose data request fails.
  • Rendering is deferred. Text added by script can enter the index later than text in the served HTML.
  • Other crawlers may not run scripts at all. Google’s documentation notes that “not all bots can run JavaScript”.

If critical text passes every check, client-side generation is working for Google. If it fails intermittently, the dependable remedy is to include the text in the served HTML.

One specific failure deserves its own diagnosis: content that is present in the served HTML and then removed or broken when the framework takes over the page. That case is covered in the guide to how JavaScript hydration failures can prevent visible content from being indexed.

The method in one line: read the served HTML, read Google’s rendered HTML, and trust the second for what Google sees.

Link trail

Reader comments on this answer

Add your comment to this answer

Your email address will not be published. Required fields are marked *