Join our newsletter! - Tips, contests and more. Click here to subscribe!
You built a page with JavaScript. It looks perfect in your browser. But when someone asks ChatGPT, Perplexity or Google’s AI Overviews a question your page answers, your page never shows up. One common reason is simple: the AI crawler never saw your content in the first place.
In this tutorial you will learn how AI crawlers read web pages, why JavaScript can hide your content from them, and how to test your own pages in a few minutes with tools you already have.
What is an AI crawler?
A crawler (also called a bot or spider) is a program that downloads web pages automatically. Search engines have used crawlers for decades. AI companies now run their own crawlers to collect pages for their assistants and AI search features. A few you will see in server logs:
- GPTBot and OAI-SearchBot (OpenAI)
- ClaudeBot (Anthropic)
- PerplexityBot (Perplexity)
- Google-Extended (a token that controls Google’s AI use of your content)
Each crawler identifies itself with a user agent string, and their operators say they follow the rules in your site’s robots.txt file.
Why JavaScript can be a problem
When you open a page in a browser, two things happen:
- The browser downloads the HTML from the server.
- The browser runs the JavaScript, which may fetch data and build the rest of the page.
A browser does both steps. Many crawlers, including many AI crawlers, mainly read the first step: the raw HTML the server sends. If your headings, text and product details are created only by JavaScript in step 2, a crawler that does not run your scripts gets an almost empty page.
Here is what a typical single-page app sends before JavaScript runs:
<!DOCTYPE html>
<html>
<head>
<title>My Store</title>
</head>
<body>
<div id="root"></div>
<!-- main.js is loaded here -->
</body>
</html>
There is nothing to read here except the title. All the real content lives inside main.js. For a deeper look at the difference between raw and rendered HTML, see this guide on JavaScript rendering and what AI crawlers see.
Test 1: View the raw HTML
The quickest check needs only your browser.
- Open your page.
- Right click and choose View Page Source (or press
Ctrl+U). - Press
Ctrl+Fand search for a sentence from the middle of your page.
If you find the sentence in the source, it is in the raw HTML. If you only see an empty <div id="root"></div> and a script reference, your content is built by JavaScript.
Note: Inspect Element in DevTools shows the page after JavaScript runs, so it is not the right tool for this test. View Page Source shows what the server actually sent.
Test 2: Fetch the page like a bot
You can download the page with a short Python script, without running any JavaScript, and even pretend to be an AI crawler by sending its user agent:
import requests
url = "https://example.com/your-page"
html = requests.get(url, headers={"User-Agent": "GPTBot"}).text
print("a sentence from your page" in html)
If the script prints False, the sentence is not in the HTML that GPTBot would receive. Try the same script with "ClaudeBot" or "PerplexityBot" as the user agent. Some servers and firewalls treat bots differently from browsers, so it is worth checking more than one.
Test 3: Turn off JavaScript in your browser
In Chrome DevTools, press Ctrl+Shift+P, type Disable JavaScript, press Enter and reload the page. What you see now is close to what a crawler that does not run scripts can read. If the page turns blank or shows only a loading spinner, you have found the problem.
Test 4: Check robots.txt
Even perfect HTML does not help if the crawler is not allowed in. Open https://your-site.com/robots.txt and look for rules like these:
User-agent: GPTBot
Disallow: /
This line blocks OpenAI’s crawler from the whole site. Sometimes this is intentional, but often it comes from a template or a plugin nobody remembers adding. If you want AI assistants to be able to read and mention your pages, make sure the crawlers you care about are not disallowed.
How to fix content that only appears with JavaScript
You do not have to give up your framework. You need the important content to exist in the HTML the server sends:
- Server-side rendering (SSR): the server runs your components and sends finished HTML. Next.js, Nuxt and SvelteKit support this.
- Static site generation (SSG): pages are built into HTML files ahead of time. Astro, Hugo, Eleventy and the static modes of Next.js work this way.
- Pre-rendering: a build step saves the rendered HTML of each route.
- At minimum: put the main heading, a short summary and key facts directly in the HTML template, and let JavaScript add the interactive parts.
Other things AI crawlers look at
Once the content is readable, a few basics help machines understand it:
- One clear
<h1>that names the topic of the page, with logical<h2>and<h3>sections below it. - A descriptive
<title>and<meta name="description">. - Structured data (schema.org JSON-LD) for things like articles, products, FAQs and organizations.
- Lists and tables for steps and comparisons, instead of long unbroken paragraphs.
- An
llms.txtfile, a newer proposal that gives AI tools a short map of your site.
Check everything in one click
Running all of these tests by hand on every page takes time. If you want a faster way, OctoCheck is a free browser extension that audits the page you are on. It checks whether AI crawlers are allowed by robots.txt, compares the raw HTML with the rendered page to catch content that appears only after JavaScript runs, and looks at headings, metadata, schema and llms.txt. Each issue comes with a short explanation of how to fix it.
It is a good way to practice what you learned in this tutorial: open one of your own projects, run the audit, and compare its findings with your manual tests.
Summary
- Many AI crawlers read the raw HTML a server sends and do not run your JavaScript the way a browser does.
- Use View Page Source, a short Python script and a browser with JavaScript disabled to see what crawlers see.
- Check
robots.txtso you are not blocking crawlers by accident. - Use server-side rendering, static generation or pre-rendering so important content is in the HTML.
- Clear headings, metadata and structured data make your page easier for machines to understand.
Making your content readable does not guarantee that an AI assistant will mention your page, but if a crawler cannot read the page at all, it has no chance.


Leave a Reply