Check 08.01 · JavaScript and HTML rendering

Inspect the initial HTML

Read the raw HTML your server returns with curl, the page source or a crawler, and check that text, links, title and canonical are in it.

Priority
Critical
Difficulty
Easy
Estimated time
30 min to 1 h
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

The initial HTML is the server's raw response, before any JavaScript runs. It is what every crawler reads first, and often all that generative engine crawlers read. This check consists of fetching this HTML for one page of each template and verifying that it already contains the main content, the navigation links, the title, the meta description, the canonical and the robots directives. Expected result: a sentence taken from the middle of the main content shows up in the curl response.

Why it matters

Google processes a page in three phases: crawling, rendering, indexing. It first reads the HTML it receives, then places the page in a rendering queue where Chromium runs the JavaScript. How long the page waits in that queue is not guaranteed. Google documents two consequences:

  • a noindex tag in the initial HTML can cause rendering to be skipped: a script that removes it afterwards may never run;
  • links present in the initial HTML are discovered during crawling, without waiting for rendering.

Bing runs JavaScript too, but its guidelines say it does so with limitations at scale.

On the GEO side (Generative Engine Optimization, visibility in AI answer engines), the gap is wider. An analysis published by Vercel in December 2024 concludes that none of the major AI crawlers observed (OpenAI's, ClaudeBot and PerplexityBot, among others) runs JavaScript: they sometimes download .js files, but do not execute them. OpenAI, Anthropic and Perplexity do not document this point. Anything that is not in the initial HTML should therefore be treated as invisible to ChatGPT Search, Claude or Perplexity. Google's AI Overviews and Copilot, on the other hand, rely on the Google and Bing indexes, which are built after rendering.

The same goes for social network preview bots (Facebook, LinkedIn, Slack): without Open Graph tags in the initial HTML, a shared link shows an empty or generic preview.

What it improves

  • Diagnosis You know which templates depend on JavaScript to display their content before you choose a fix.
  • Visibility in generative engines Content present in the initial HTML can be read by crawlers that do not run JavaScript. This is a prerequisite, not a guarantee of being cited.
  • Indexing by Google and Bing Faster link discovery and less dependence on the rendering queue. The effect is indirect.
  • Share previews Correct titles and images on social networks and messaging apps.
  • Rankings No direct effect. The initial HTML is not a ranking factor, but content that is not seen cannot be ranked.

How to check

Take a sentence from the middle of the main text, visible on screen, and search for it in the server response:

curl -s -L https://example.com/ma-page | grep -c "sentence copied from the page"

A result of 1 or more passes. 0 means the sentence is added by JavaScript, or that it contains encoded characters (&, ', curly apostrophe): pick a sentence without punctuation to rule this out.

Then check the head tags:

curl -s -L https://example.com/ma-page | grep -i -o -E "<title[^>]*>[^<]*</title>|<meta[^>]+name=\"(description|robots)\"[^>]*>|<link[^>]+rel=\"canonical\"[^>]*>"

Expected result: one title, one meta description, one canonical, and a meta robots tag that is either absent or free of noindex for a page meant to be indexed.

Warning: the “Elements” tab of the browser's developer tools shows the DOM after JavaScript, not the initial HTML. For this check, use the page source (Ctrl+U, Cmd+Option+U on Mac) or the response in the Network tab.

How to implement

Before you start

Pick one representative URL per template: home page, category, product or service page, article, local page, paginated results. A 10,000-page site often has only a dozen templates; those are what you audit.

For each URL, check that these elements are present in the initial HTML:

Element Where to look Why
Main text page body the only content AI crawlers can read
<title> and meta description <head> snippet in search results, previews
<link rel="canonical"> <head> consolidation of duplicates
<meta name="robots"> <head> a noindex can block rendering
<a href> links in the menu, breadcrumbs, pagination body page discovery
JSON-LD structured data <head> or body rich results, understanding of entities
Open Graph tags <head> share previews
<h1> body structure, understanding of the topic

With curl

Save the response twice, once with a browser user agent and once with the Googlebot smartphone user agent. If the two differ, the site serves content based on the crawler: check that this is intended.

URL="https://example.com/ma-page"
curl -s -L -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Safari/537.36" "$URL" -o initial-navigateur.html
curl -s -L -A "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" "$URL" -o initial-googlebot.html
wc -c initial-*.html

The following script summarizes what an HTML file contains. It uses only the Python standard library. Save it as audit_html.py:

#!/usr/bin/env python3
"""Usage: python3 audit_html.py page.html [--texte]"""
import re
import sys
from html.parser import HTMLParser

IGNORED = ("script", "style", "noscript", "template")


class Audit(HTMLParser):
    def __init__(self):
        super().__init__()
        self.title, self.in_title, self.title_done = "", False, False
        self.metas, self.canonicals, self.h1 = {}, [], []
        self.in_h1, self.skip = False, 0
        self.links, self.fake_links, self.jsonld = 0, 0, 0
        self.text = []

    def handle_starttag(self, tag, attrs):
        a = {k: (v or "") for k, v in attrs}
        if tag == "title" and not self.title_done:
            self.in_title = True
        elif tag == "meta" and a.get("name"):
            self.metas[a["name"].lower()] = a.get("content", "")
        elif tag == "link" and "canonical" in a.get("rel", "").lower().split():
            self.canonicals.append(a.get("href", ""))
        elif tag == "h1":
            self.in_h1 = True
            self.h1.append("")
        elif tag == "a":
            href = a.get("href", "").strip()
            if href and not href.startswith(("#", "javascript:")):
                self.links += 1
            else:
                self.fake_links += 1
        elif tag == "script" and a.get("type") == "application/ld+json":
            self.jsonld += 1
        if tag in IGNORED:
            self.skip += 1

    def handle_endtag(self, tag):
        if tag == "title" and self.in_title:
            self.in_title, self.title_done = False, True
        elif tag == "h1":
            self.in_h1 = False
        if tag in IGNORED and self.skip:
            self.skip -= 1

    def handle_data(self, data):
        if self.in_title:
            self.title += data
            return
        if self.in_h1:
            self.h1[-1] += data
        if not self.skip and data.strip():
            self.text.append(" ".join(data.split()))


page = Audit()
page.feed(open(sys.argv[1], encoding="utf-8", errors="replace").read())

if "--texte" in sys.argv:
    print("\n".join(page.text))
    sys.exit()

print(f"title          : {page.title.strip()!r}")
print(f"description    : {page.metas.get('description', '')!r}")
print(f"robots         : {page.metas.get('robots', '')!r}")
print(f"canonical      : {page.canonicals}")
print(f"h1             : {[h.strip() for h in page.h1]}")
print(f"href links     : {page.links}")
print(f"fake links     : {page.fake_links}")
print(f"JSON-LD blocks : {page.jsonld}")
print(f"visible words  : {len(re.findall(r'\w+', ' '.join(page.text)))}")
python3 audit_html.py initial-navigateur.html
python3 audit_html.py initial-navigateur.html --texte | less

Warning signs: fewer than a hundred or so visible words on a content page, no href links apart from a few footer links, the same generic title on every template, or a body reduced to <div id="root"></div> or <div id="app"></div>.

With the browser

Without the command line:

  1. Open the page, then display the page source: Ctrl+U (Windows, Linux) or Cmd+Option+U (Mac), or prefix the address with view-source:.
  2. Search (Ctrl+F) for a sentence from the main content, the word canonical, noindex and application/ld+json.
  3. To see the page as a crawler without JavaScript reads it, open the developer tools, then the Command Menu (Ctrl+Shift+P, Cmd+Shift+P on Mac), type “Disable JavaScript” and reload. What you see then is what AI crawlers receive. The setting only lasts while the developer tools stay open.
  4. To simulate a user agent, open More tools > Network conditions in the developer tools, uncheck the automatic user agent selection and choose Googlebot.

Work in a private window: a logged-in session or cookie consent already given can change the response.

With Screaming Frog

Screaming Frog's default crawl mode (“Text Only”) reads the initial HTML without running JavaScript, like an AI crawler. Run a crawl, then compare the “Word Count”, “Title 1” and “Canonical Link Element 1” columns and the number of outlinks per template. Pages with a few dozen words or no internal links depend on JavaScript. To compare with the render, see compare initial HTML and rendered DOM (opens in a new tab).

Points to watch by platform

Platform What is most often missing from the initial HTML
WordPress reviews, tab content or “load more” content added by a plugin through AJAX (Asynchronous JavaScript and XML)
Shopify customer reviews, recommendations and blocks injected by apps
Wix content loaded by Velo code outside the onReady() function
Next.js, Nuxt components rendered only on the client, data fetched in the browser
React, Vue, Angular without server rendering almost everything: the body is just an empty container

Deliverable: audit table

Template URL tested Content sentence found Title Canonical Robots href links JSON-LD Action
Product page /produits/chaise-oslo yes yes yes absent 84 2 none
Category /chaises no (empty list) yes yes absent 12 0 server-render the list
Article /blog/choisir-chaise yes generic missing absent 40 0 fix the template

Fixes go through server or static rendering of critical content (opens in a new tab) and links available in HTML with href (opens in a new tab).

Common mistakes

  • Auditing with the “Elements” tab: it shows the DOM as modified by JavaScript, so a page looks complete even when the initial HTML is empty.
  • Testing a single page: one healthy template does not guarantee another. Test every page type.
  • Forgetting redirects: without the -L option, curl stops at the redirect and you audit an empty page.
  • Testing from a logged-in session: the CMS then adds admin bars or restricted content. Use curl or a private window.
  • Concluding that Google sees nothing: Google runs JavaScript. Content missing from the initial HTML usually remains indexable by Google, but with a delay and a risk of errors; it is, however, lost to AI crawlers that do not run scripts.
  • Ignoring the response served to Googlebot: a firewall or dynamic rendering can send it something different from what visitors get. Compare the two files.

Frequently asked questions

How do I see a page's initial HTML?

To see a page's initial HTML, display its source with Ctrl+U, or Cmd+Option+U on Mac, or run curl -s -L followed by the URL in a terminal. Both methods show the server's raw response, before JavaScript. The Elements tab of the developer tools, by contrast, shows the DOM as modified by scripts: it is not suitable for this check.

Do ChatGPT and Perplexity see content loaded with JavaScript?

According to an analysis published by Vercel in December 2024, OpenAI's crawlers, ClaudeBot and PerplexityBot do not run JavaScript: they read the initial HTML. OpenAI, Anthropic and Perplexity do not officially document this point. To be safe, assume that text added by a script is invisible to these engines, and put the main content, links and metadata in the server response.

Does Google index content missing from the initial HTML?

Yes, Google usually indexes content added by JavaScript, because it runs scripts in a recent version of Chromium during a rendering phase. This rendering goes through a queue with no guaranteed delay, fails if a script or an API is blocked, and can be skipped if the initial HTML contains a noindex. Content present in the initial HTML remains the safest route.

How many pages should I inspect?

Inspect one page per template rather than a random sample: home page, category, product or service page, article, local page and paginated page. Pages built from the same template share the same code, and therefore the same behavior. Add a crawl in no-JavaScript mode to spot the exceptions, such as pages with unusually few words or links.

Updated on

Topic checklist (PDF)

And now?

In the “JavaScript and HTML rendering” topic

  1. Inspect the initial HTML
  2. Compare initial HTML and rendered DOM
  3. Test rendering in Search Console
  4. Prefer SSR/SSG for critical content if relevant
  5. Make content accessible without user interaction
  6. Make links available in HTML with href
  7. Avoid links that rely solely on JS events
  8. Check title, description and canonical after rendering
  9. Check rendered structured data
  10. Fix JS and hydration errors
  11. Check content loaded via API
  12. Check dynamic pagination
  13. Check SPA HTTP status codes
  14. Avoid information available only in Canvas
  15. Test which information is accessible without JS