JavaScript Rendering and AI Search: SSR vs. CSR vs. SSG
JavaScript rendering for AI search decides whether an AI crawler sees your content or an empty shell. A page can look perfect in Chrome and still send almost no text to a crawler that does not run JavaScript. For many modern websites, that gap is the biggest hidden barrier to AI visibility.
This guide explains how crawlers retrieve content, compares client-side rendering, server-side rendering and static generation, and gives framework-specific advice. It also includes a tested Python script that compares raw HTML with the rendered page.
How do crawlers retrieve website content?
Short answer: Every crawler first downloads the raw HTML the server sends. Some, like Googlebot, later run JavaScript to see the final page. Many AI crawlers stop at the raw HTML, so content that only appears after scripts run may never reach them.
Google documents a separate rendering step in its JavaScript SEO basics: Googlebot crawls, queues pages for rendering and then indexes the rendered result. However, that capability should not be assumed for every AI crawler. A Vercel study of AI crawler traffic found that the major AI crawlers it measured do not execute JavaScript.
What is client-side rendering (CSR)?
Short answer: With CSR, the server sends a mostly empty HTML file plus JavaScript, and the browser builds the page. It feels fast after the first load, but crawlers that do not run JavaScript receive little or no content.
In JavaScript rendering for AI search, CSR is the main concern. Typical single-page apps built with plain React, Vue or Angular use CSR by default. The raw HTML often contains only a root element such as a div with an id of “app”. For JavaScript rendering for AI search, this is the riskiest model.
What is server-side rendering (SSR)?
Short answer: With SSR, the server builds the full HTML for each request and sends it ready to read. Crawlers receive the complete content immediately, while JavaScript still adds interactivity afterward.
For JavaScript rendering for AI search, SSR is a safe default. It costs more server work per request, but it gives every crawler the same content a user sees. It suits pages with frequently changing data, such as pricing, inventory or personalized dashboards that still need public versions.
What is static site generation (SSG)?
Short answer: With SSG, pages are built into HTML files ahead of time and served as static files. Crawlers get complete content, and pages load fast, but updates require a rebuild.
SSG fits content that changes on a schedule, such as blog posts, documentation and service pages. Many frameworks also support incremental regeneration, which rebuilds individual pages after a set time.
| Approach | Content in raw HTML | Best for | AI crawler risk |
|---|---|---|---|
| CSR | Little or none | Logged-in apps, dashboards | High |
| SSR | Full | Dynamic public pages | Low |
| SSG | Full | Blogs, docs, marketing pages | Low |
What about hydration and dynamically injected content?
Short answer: Hydration attaches JavaScript to server-rendered HTML, which is safe. The risk comes from content injected only after load, such as tabs, accordions, reviews widgets or prices fetched by API calls.
Even on SSR or SSG sites, teams often load key blocks on the client. Common examples include FAQ answers inside collapsed components, testimonials from third-party widgets and pricing tables fetched from an API. Each of these may be missing from the raw HTML that AI crawlers receive.
What should React, Next.js, Angular and Vue teams know about JavaScript rendering for AI search?
Short answer: Use the framework’s server or static rendering mode for every public page. Plain client-side React, Vue or Angular apps need a server rendering layer or pre-rendering before they are reliable for AI crawlers.
- React: use a framework with server rendering, such as Next.js or Remix, for public pages.
- Next.js: prefer Server Components and static generation for marketing and content pages, and avoid fetching core copy only in client components.
- Angular: enable server-side rendering and pre-rendering for public routes.
- Vue: use Nuxt with server or static rendering instead of a client-only build.
How do you test JavaScript rendering for AI search with raw and rendered HTML?
Short answer: Fetch the page once without JavaScript and once in a headless browser, extract the visible text from both and compare. Any key phrase found only in the rendered version is invisible to crawlers that skip JavaScript.
The quickest check uses cURL. If an important phrase is missing from the raw response, it depends on JavaScript:
# Fetch the raw HTML the way a non-rendering crawler would
curl -s -A "Mozilla/5.0 (compatible; RenderCheck/1.0)" https://www.example.com/pricing/ -o raw.html
# Is a key phrase present without JavaScript?
grep -c "free trial" raw.html || echo "Not in raw HTML: likely injected by JavaScript"
For a fuller test, this Python script uses Playwright to render the page and reports how much of the content exists without JavaScript:
#!/usr/bin/env python3
"""Compare the raw HTML a crawler receives with the DOM a browser renders.
Install: pip install requests beautifulsoup4 playwright && playwright install chromium
Usage: python compare_render.py https://www.example.com/page/ "key phrase 1" "key phrase 2"
"""
import sys
import requests
from bs4 import BeautifulSoup
from playwright.sync_api import sync_playwright
UA = "Mozilla/5.0 (compatible; RenderCheck/1.0)"
def visible_text(html):
soup = BeautifulSoup(html, "html.parser")
for tag in soup(["script", "style", "noscript", "template"]):
tag.decompose()
return " ".join(soup.get_text(" ").split())
def raw_html(url):
return requests.get(url, headers={"User-Agent": UA}, timeout=20).text
def rendered_html(url):
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page(user_agent=UA)
page.goto(url, wait_until="networkidle")
html = page.content()
browser.close()
return html
def main(url, phrases):
raw = visible_text(raw_html(url))
rendered = visible_text(rendered_html(url))
raw_words, rendered_words = len(raw.split()), len(rendered.split())
share = raw_words / rendered_words if rendered_words else 0
print(f"Words in raw HTML: {raw_words}")
print(f"Words in rendered DOM: {rendered_words}")
print(f"Share present without JavaScript: {share:.0%}")
for phrase in phrases:
in_raw = phrase.lower() in raw.lower()
in_dom = phrase.lower() in rendered.lower()
status = "OK" if in_raw else ("JS ONLY" if in_dom else "MISSING")
print(f"[{status}] {phrase}")
if __name__ == "__main__":
main(sys.argv[1], sys.argv[2:])
We tested it on a sample client-rendered page. The raw HTML held only 29% of the rendered words, and a “free trial” phrase was flagged as JS ONLY.
How do you choose an architecture for JavaScript rendering for AI search?
Short answer: Use SSG for content that changes on a schedule, SSR for public pages with live data and CSR only for logged-in areas. Then test key templates with the script after every major release.
- List your public page templates and their purpose.
- Run the comparison script on one URL per template.
- Move any template below roughly 90% raw content to SSR or SSG.
- Render critical blocks, such as pricing and FAQs, on the server.
- Add the check to your release process so regressions are caught early.
Rendering is one item in a wider set of checks. Our technical AEO checklist covers the rest.
Frequently asked questions about JavaScript rendering for AI search
Does Googlebot render JavaScript?
Yes. Google documents a rendering step for JavaScript pages. That does not mean other AI crawlers do the same, so test raw HTML too.
Is client-side rendering bad for SEO and AI search?
It is risky for public content. Google can usually handle it, but AI crawlers that do not run JavaScript may see empty pages.
Do I need to rebuild my whole site to fix JavaScript rendering for AI search?
Usually not. Start with the templates that matter most, such as service, pricing and blog pages, and move them to server or static rendering first.
Can pre-rendering services solve the problem?
They can serve static snapshots to bots, but they add complexity and can drift from what users see. Native SSR or SSG is usually easier to maintain.
How often should we test rendering?
After every major release and whenever you add new components to public templates. A quick automated check prevents silent regressions.
Next step
Run the cURL check on your homepage, pricing page and top blog post today. If key text is missing, plan a move to SSR or SSG for those templates.
Want more practical guides on JavaScript rendering for AI search? Browse the latest articles on the Blippu blog.