Academy / GEO · AI

GEO · AI

Content that depends on JavaScript: what bots see

By Fernando BalcázarReviewed on 6 min read

The essentials

  • A bot that does not run JavaScript only reads the HTML the server sends. Whatever JavaScript adds later does not exist for it.
  • Google documents that it renders pages with Chromium, though it may take a while. OpenAI, Anthropic and Perplexity do not document whether their bots do.
  • The safe bet is to have the title, the H1, the main text, the links and the schema in the HTML already.
  • The fix is to render on the server or build pages ahead of time, not to hide content behind a click or a script.

What happens when content arrives with JavaScript

When a browser opens your page, it first gets the HTML and then runs the scripts, which may paint text, prices, reviews or FAQs. A bot that only reads the HTML keeps the first part.

Google solves it by rendering: it queues the page and opens it with Chromium when it has resources, so what JavaScript adds may take a while to count. Nothing is documented for AI bots: neither OpenAI, Anthropic nor Perplexity says whether they run JavaScript. Until they do, the prudent choice is not to rely on it.

How to tell whether your page depends on JavaScript

  1. Run the URL through the bot simulator: it compares the raw HTML with the rendered page and lists the text that only appears with JavaScript.
  2. Or do it by hand: in the browser, put view-source: before the URL and search for a sentence from your main text. If it is not in the source, JavaScript adds it.
  3. Pay most attention to the title, the H1, the canonical, the internal links and the JSON-LD.

Where it usually happens

  • Single-page apps built with React, Vue or Angular without server rendering: the HTML carries an empty container, like <div id="root"></div>, and everything else arrives through JavaScript.
  • Blocks that load separately on sites that do generate HTML: reviews, prices, FAQs, tabs or carousels that fetch their content after the page loads.
  • Schema injected by a script or by the tag manager. Google can read JSON-LD added with JavaScript, but a bot that does not run it will not see it.

WordPress, Shopify and most CMSs generate the HTML on the server, so the main text is usually there. On those, check the plugins that load content separately.

How to fix it

If you useWhat to do
Next.jsKeep the content in server components or static pages, and avoid loading it with useEffect on the client.
NuxtServer rendering is on by default; do not turn it off with ssr: false.
AngularTurn on server-side rendering or route prerendering.
React or Vue with Vite, no frameworkPrerender the public pages at build time, or move to a framework with server rendering.
A CMS with blocks that load separatelyLook for the plugin option that prints the content in the HTML, or switch to one that does.

Google calls “dynamic rendering” (serving pre-rendered HTML only to bots) a workaround, not a recommendation. It is better for everyone, people and bots, to get the same HTML.

Common mistakes

  • Assuming every bot is like Googlebot. Google renders; there is no guarantee for the rest.
  • Setting the canonical or the title only with JavaScript. If the HTML says otherwise, the bot keeps the HTML one.
  • Hiding text behind a click (“Read more”, tabs that load when opened). If it is not in the HTML, the bot does not read it.
  • Showing bots different content than people. It is fragile and can be taken as cloaking.

ToolHow a bot sees your page →