Skip to content
Technical SEO

JavaScript SEO: How Google and AI Crawlers See Your Site

13 min readPublished By Sanju Joseph

Most modern websites depend on JavaScript. React, Vue, Svelte and Angular apps, Shopify themes with app scripts, WordPress sites with page builders: all of them use JavaScript to build at least part of what visitors see. That is not a problem in itself. Google has been able to render JavaScript for years. The problem is the gap between what your server sends and what a visitor eventually sees, because every crawler handles that gap differently, and some do not handle it at all.

This guide explains how Google processes JavaScript pages, what each rendering strategy (client-side, server-side, static, hybrid) means for SEO, the specific patterns that hide content and links from crawlers, why most AI crawlers see only your raw HTML, and how to test what search engines actually receive. It is written for site owners and marketers as much as developers: you do not need to write JavaScript to diagnose most of these problems.

The Mental Model: Two Versions of Every Page

Every page that uses JavaScript exists in two versions:

  1. The initial HTML: what the server sends in response to the request. This is what you see with "View Page Source" in your browser, or with curl.
  2. The rendered DOM: what the page looks like after the browser has downloaded and run all the JavaScript, fetched any data, and updated the page. This is what you see in the browser's "Inspect" panel.

For a traditional server-rendered site, the two are almost identical. For a client-side single-page app, the initial HTML may be nearly empty:

<!doctype html>
<html lang="en">
  <head>
    <title>Loading...</title>
    <script src="/assets/app.4f2a9c.js" defer></script>
  </head>
  <body>
    <div id="root"></div>
  </body>
</html>

Everything a search engine cares about, the title, the headings, the text, the links, the structured data, only exists after app.js runs. JavaScript SEO is mostly about one question: does each crawler you care about get the rendered version, and if so, when?

How Google Processes JavaScript

Google's JavaScript SEO documentation describes three phases: crawling, rendering and indexing.

1. Crawling

Googlebot requests the URL and receives the initial HTML. Before doing anything else it checks robots.txt; if the URL is disallowed, it stops. It parses the initial HTML for links in <a href> elements and adds them to the crawl queue.

2. Rendering

Pages that return a 200 status are queued for rendering, unless a robots meta tag or header tells Google not to index them. When resources allow, Google's Web Rendering Service (WRS) loads the page in a headless Chromium browser, runs the JavaScript and produces the rendered HTML. Since 2019 Googlebot has been "evergreen", meaning the WRS runs a recent version of Chromium and supports modern JavaScript features.

Google's documentation says a page may stay in the render queue for a few seconds, but it can take longer. For most sites the delay is short, but rendering is a separate step with its own resource limits, and content that only appears after rendering is discovered later than content in the initial HTML.

3. Indexing

Google uses the rendered HTML to index the page and parses it again for links, which then go back into the crawl queue. Anything that was not in the rendered HTML, because it needed a click, a scroll, a login or a script that failed, is not indexed.

Rendering is a second chance, not a guarantee. Content and links that are present in the initial HTML are found first and most reliably, by every crawler.

A few documented details catch people out:

  • A noindex in the initial HTML wins. Google's documentation says that if the initial HTML contains noindex, Google may skip rendering entirely, so JavaScript that later removes the tag will not run. The reverse also applies: adding noindex with JavaScript is unreliable. Set robots directives on the server.
  • Blocked resources break rendering. If robots.txt blocks the JavaScript, CSS or API endpoints a page needs, the WRS renders a broken or empty page. Test your rules with the robots.txt tester, and read the robots.txt guide before blocking any /api/ or /assets/ paths.
  • The WRS does not keep state. Each page is rendered fresh: no cookies carried over, no local storage, no service worker cache, and permission requests (location, notifications) are declined. Content that depends on those will not render for Google.
  • The WRS does not click or scroll like a person. It does not click buttons or tabs. Rather than scrolling, Google has described resizing the viewport to a very tall page so that content loaded by scroll-based lazy loading has a chance to appear, but content that needs an actual user interaction stays hidden.

Rendering Strategies Compared

The single biggest JavaScript SEO decision is where your HTML is generated. Here is how the common approaches compare:

StrategyHow it worksInitial HTML has content?SEO fit
Client-side rendering (CSR)Server sends an empty shell; the browser builds the pageNoWeakest. Relies entirely on rendering. Fine for logged-in apps and dashboards
Server-side rendering (SSR)Server builds full HTML on each request, then JavaScript "hydrates" it to make it interactiveYesStrong. Good for frequently changing content
Static site generation (SSG)HTML built once at deploy time and served from a CDNYesStrong and fast. Good for content that changes rarely
Incremental / on-demand staticStatic pages regenerated in the background after a set time or on demandYesStrong. Good for large catalogues
Streaming SSR and server componentsServer sends HTML in chunks as data becomes readyYes, in the streamed responseStrong, if critical content is not deferred to the client
Dynamic renderingServer detects bots and sends them pre-rendered HTML, while users get CSRFor bots onlyA workaround Google no longer recommends

Google's documentation describes dynamic rendering as a workaround rather than a long-term solution and recommends server-side rendering, static rendering or hydration instead. Serving different content to bots and users also adds complexity and creates a risk of the two versions drifting apart.

Modern frameworks make good defaults easy. Next.js, Nuxt, SvelteKit, Remix and Astro all render on the server or at build time by default. The usual mistake in these frameworks is opting individual components out of server rendering, for example fetching a product description in a client-side effect, which quietly turns part of an SSR page back into CSR.

Patterns That Hide Content From Crawlers

Most JavaScript SEO problems come from a short list of patterns. Each has a simple fix.

Links that are not links

Google's documentation is explicit: it can only reliably follow links that are <a> elements with an href attribute containing a resolvable URL.

<!-- Crawlable -->
<a href="/pricing">Pricing</a>
<a href="https://example.com/blog/hreflang-guide">Hreflang guide</a>

<!-- Not reliably crawlable -->
<span onclick="goTo('/pricing')">Pricing</span>
<a onclick="router.push('/pricing')">Pricing</a>
<a href="javascript:goTo('/pricing')">Pricing</a>
<button data-href="/pricing">Pricing</button>

Framework link components such as Next.js <Link> or Vue Router's <router-link> render real <a href> elements, so they are fine. Problems appear with custom click handlers on divs, menus that only build their links on hover, and "load more" buttons that replace pagination. Run any important page through the internal link analyzer, which reads the links present in the HTML, to see what a crawler finds.

Hash-based routing

Older single-page apps use URL fragments for routing: example.com/#/products/shoes. Google generally ignores everything after the #, so all of those "pages" collapse into one URL. Use the History API (regular paths like /products/shoes), which every modern router supports. The old #! "AJAX crawling scheme" was deprecated by Google back in 2015.

Content behind interactions

Text that loads only when someone clicks a tab, expands an accordion, presses "Read more" or opens a modal may never be rendered for Google if it is fetched on click. The fix is to include the content in the HTML and use CSS or the <details> element to collapse it. Content that is in the DOM but visually collapsed is indexed; content that does not exist until a click is not.

Infinite scroll without paginated URLs

Infinite scroll is fine for users, but crawlers need a way to reach item 50 without scrolling. Give each chunk its own URL (?page=2, /page/2/), link to them with real anchors, and update the URL with the History API as the user scrolls. The pagination checker shows whether paginated pages are discoverable and self-canonical.

Lazy loading that waits for scroll events

Lazy-loaded images and sections that rely on scroll event listeners may not load during rendering. Use native lazy loading (loading="lazy") for images and the IntersectionObserver API for other content; both work with Google's rendering approach. Never lazy-load content in the first screen. The lazy-loading checker flags images that are lazy-loaded above the fold, and the image SEO guide covers lazy loading for images in detail.

Metadata set only by JavaScript

Titles, meta descriptions, canonicals, hreflang and robots tags set by client-side code are processed after rendering, if at all, and social platforms such as LinkedIn, Slack and Facebook do not run JavaScript when they build link previews. Put all head metadata in the server response. Our meta tags guide covers how to do this in common frameworks, and the meta tag analyzer checks what the server actually returns.

Soft 404s in single-page apps

In a CSR app, the server often returns a 200 status with the app shell for every URL, and the app shows a "not found" message for unknown routes. To Google that is a soft 404, and the URL may stay in its index. Fix it by returning a real 404 from the server for unknown routes, or, if that is impossible, by redirecting to a URL that returns 404 or adding noindex on the server response. The soft 404 detector tests suspect URLs.

Structured data injected late

Google can read JSON-LD added by JavaScript, but it is processed only after rendering and is invisible to crawlers that do not render. Output structured data in the server HTML where you can. The schema markup tester shows what is present on the page.

AI Crawlers Mostly Do Not Run JavaScript

This is the change that has made JavaScript SEO matter again. Google renders; most AI crawlers do not.

Research published in late 2024 by Vercel and MERJ, analysing crawler traffic across Vercel's network, found that the major AI crawlers, including OpenAI's GPTBot and Anthropic's ClaudeBot, fetched JavaScript files but did not execute them. In practice, they saw only the initial HTML. The same research noted that Google's Gemini relies on Googlebot's infrastructure, which does render, and that AppleBot renders as well. Crawler behaviour can change at any time, but the safe assumption in 2026 is that a crawler other than Googlebot or Bingbot is reading your raw HTML.

That has real consequences:

  • A CSR product page may rank in Google while being an empty shell to ChatGPT's and Claude's crawlers, so those assistants cannot quote it.
  • Answer engines that fetch pages live during a conversation, such as ChatGPT search or Perplexity, generally use fetchers that also read the initial HTML.
  • Reviews, prices and FAQs loaded from a third-party widget after page load are usually invisible to these systems.

To see your page the way a non-rendering crawler does, run it through the page-to-Markdown exporter, which converts the HTML your server returns into the plain text an AI system would read. The text-to-HTML ratio checker is a quick warning light: a very low ratio on a content page often means the text is not in the initial HTML. Then check that the bots are allowed in at all with the AI crawler access test. Our guides to AEO and LLMO cover the content side, and the LLM optimization checklist includes server-rendered content as a core item.

How to Test What Search Engines See

The old shortcuts are gone: Google removed the cache: search operator and its cached page links in 2024, and retired the standalone Mobile-Friendly Test in December 2023. These are the methods that work now.

1. Compare the source with the rendered DOM

Open the page, then use View Page Source (Ctrl+U or Cmd+Option+U) to see the initial HTML. Search it for a sentence from your main content, your H1 and a few important links. If they are missing from the source but visible on the page, they depend on JavaScript. From a terminal:

curl -s https://example.com/products/trail-runner | grep -i "trail runner"

Disabling JavaScript in your browser's developer tools and reloading the page gives you a similar view.

2. URL Inspection in Google Search Console

The URL Inspection tool is the closest thing to seeing a page as Google does. Run a live test, then choose "View tested page" to see the rendered HTML, a screenshot, the page resources Google could and could not load, and JavaScript console messages. Compare the rendered HTML with what you expect. Our Google Search Console guide covers the tool in detail.

3. Rich Results Test

Google's Rich Results Test uses the same rendering and works on any public URL, even one you have not verified in Search Console. Besides checking structured data, it shows the rendered HTML, which makes it handy for testing competitors or staging pages that are publicly reachable.

4. Check that the content is indexed

Search Google for a distinctive sentence from the JavaScript-loaded part of the page in quotes, optionally with site:yourdomain.com. If the page is indexed but that sentence never matches, Google probably did not see that content. This is a rough check, since Google does not index every word of every page, but it is quick.

5. Watch the server logs

Logs show which URLs Googlebot and other crawlers fetch, including JavaScript files and API calls made during rendering. If Googlebot never requests your API endpoint, rendering is not reaching your content. The AI bot crawl log parser sorts AI crawler visits from your logs, and the crawl budget guide explains how to read crawl patterns more generally.

Performance Is Part of JavaScript SEO

Even when Google renders everything correctly, heavy JavaScript hurts visitors and Core Web Vitals:

  • Largest Contentful Paint (LCP) suffers when the main content or hero image waits for JavaScript to run before it appears.
  • Interaction to Next Paint (INP) suffers when large bundles and hydration keep the main thread busy, so taps and clicks feel sluggish.
  • Cumulative Layout Shift (CLS) suffers when content is injected above what the visitor is already reading.

Practical fixes: render on the server, split bundles by route, defer non-critical scripts, remove unused libraries, and audit third-party tags. The page speed test shows where scripts slow each page down, and our page speed guide and Core Web Vitals guide cover the fixes step by step.

A JavaScript SEO Checklist

  1. Main content, headings and primary images are in the initial HTML for every indexable page.
  2. Title, meta description, canonical, robots and hreflang tags are in the server response, not added by client code.
  3. Every navigational link is an <a href> with a real URL; no hash routing.
  4. Collapsed content (tabs, accordions) exists in the DOM on load.
  5. Paginated or infinite-scroll lists have crawlable URLs for each page.
  6. Unknown routes return a real 404 status.
  7. robots.txt does not block JavaScript, CSS or the APIs needed to render the page.
  8. Structured data is output on the server.
  9. AI crawlers are allowed and the raw HTML reads well as plain text.
  10. URL Inspection's rendered HTML matches what users see for each main template.

A full site audit checks many of these across the site at once, and the technical SEO checklist puts them in context with the rest of your technical work.

Frequently Asked Questions

Can Google index JavaScript websites?

Yes. Google renders pages with a recent version of Chromium and indexes the rendered content. The caveats are that rendering happens after crawling, content that needs a user interaction is not seen, and blocked or failing scripts produce incomplete pages. Server-rendered HTML removes all of those risks.

Is client-side rendering bad for SEO?

Not automatically for Google, but it adds risk and delay, and it makes your content largely invisible to crawlers that do not run JavaScript, which includes most AI crawlers. For pages you want found, such as marketing pages, product pages and articles, server-side or static rendering is the safer choice. CSR is fine behind a login.

Does Bing render JavaScript?

Bing has said that Bingbot can render JavaScript, but like Google it recommends not relying on that for critical content, and it has historically suggested dynamic rendering for heavy JavaScript sites. Server-rendered content works for both.

Should I use dynamic rendering?

Only as a temporary measure if you cannot change your rendering approach. Google describes it as a workaround and not a recommended solution. It is not cloaking as long as bots and users get the same content, but maintaining two outputs is fragile. Server-side rendering or static generation is the long-term fix.

Do I need to worry about JavaScript if I use WordPress or Shopify?

Less than with a custom single-page app, because both platforms render pages on the server. The risks come from add-ons: page builders, review widgets, "load more" product grids, and apps that inject content or metadata after page load. Check the page source for anything important that appears only after scripts run.

How do I know if AI crawlers can see my content?

Look at the raw HTML your server returns, for example with View Page Source or the page-to-Markdown exporter. If your main content is there and robots.txt allows the bots, AI crawlers can read it. If the content only appears after JavaScript runs, assume most of them cannot.