Search 4 min read Updated
What Google can see on a JavaScript page
In short
Google can render JavaScript, but server-side or pre-rendered HTML with crawlable links is still the safer default for content that must be found.
Many sites now build pages with JavaScript, and it is easy to assume that search engines see exactly what a visitor sees. Google can render JavaScript, but that step takes extra work and is not guaranteed for every page. Text that is already in the first HTML response does not depend on it. The guidance comes from Understand the JavaScript SEO basics and Link best practices for Google.
How Google processes JavaScript pages
Google describes three main phases: crawling, rendering and indexing. In the crawling phase, Googlebot checks robots.txt first. Blocked URLs are skipped, and if robots.txt blocks a JavaScript file, Google cannot use it to render the page. A blocked script therefore harms the rendered view of the page, not only the crawl.
Pages that return a 200 status code are queued for rendering. A headless Chromium then renders the page and runs the JavaScript. Google says the page may wait in this queue for a few seconds, but it can take longer. After rendering, the rendered HTML is used for indexing. Content that appears only after rendering therefore depends on that queue, while a page that already contains its text in the first response does not.
Links must be real links
Links are the route by which a search engine reaches the rest of the site, so their markup matters more than their appearance. A link can be discovered only when it is an a element with an href attribute. Google states that it cannot reliably extract URLs from an a element without an href. JavaScript is allowed to inject links into the page, provided they use the same crawlable markup.
- Use an a element with a real href for every link you want found.
- Do not replace links with click handlers that only change the page state.
- Give each link visible text, because Google labels empty link text as bad.
- After a change, check in the URL Inspection Tool that the links appear in the rendered HTML.
Internal linking has its own rules about wording and placement. For those, see Internal links that search engines can follow.
Working on something similar in your own product? A few honest sentences are enough – we read every enquiry and reply by email. Apply with your idea
Status codes and error pages
Googlebot uses HTTP status codes to detect crawl problems. A missing page should return a 404, and a page behind a login should return a 401. Google notes that if the status code is not 200, for example on an error page with a 404 status, rendering might be skipped. The status code therefore has to be right on the server, not only in what the page displays.
Client-side single-page apps can make this difficult, because the server often returns the same shell for every address. According to the guidance, meaningful status codes can be impossible or impractical in that setup. Two workarounds are suggested: redirect to a server URL that returns a 404, such as /not-found, or add a noindex robots meta tag with JavaScript.
When plain HTML is safer
Google’s guide says that server-side rendering or pre-rendering is still a great idea, because it speeds up the site for users and crawlers, and because not all bots can run JavaScript. Pages with HTML that already contains the content work well for search. The risky case is a client-rendered app shell, where the initial HTML does not contain the content and JavaScript must run before anything can be read.
For content that has to be found, such as articles, product listings and category pages, a server-rendered or pre-rendered page is the safer default. Interactive tools can still use JavaScript on top of that HTML. One thing is enough to check: the important text stays on the page even if JavaScript fails or is delayed.
A practical check before launch
Before a release that changes how pages are built, run through this list on a few representative pages:
- Open the raw HTML response and confirm that the title, the main text and the internal links are present.
- Compare it with the rendered page in the URL Inspection Tool, and note anything that appears only after rendering.
- Check that every link you need is an a element with an href.
- Request a missing address and confirm that it returns a 404 status, not a 200 page with a “not found” message.
- Make sure robots.txt does not block the scripts or files needed to render the page.
If a page fails the first check, consider whether the content can be rendered on the server before adding more JavaScript. For the directives that control indexing, read robots.txt and noindex: the difference.
Common questions
- Does Google index content that appears only after JavaScript runs?
- Google renders pages that return a 200 status code and then indexes the rendered HTML. The rendering step may wait in a queue for a few seconds or longer, so content that depends on it is less certain.
- Which links can Google follow on a JavaScript page?
- Google can only discover links that are a elements with an href attribute. JavaScript may inject links into the page if they use the same crawlable markup.
- What status code should a missing page return in a single-page app?
- Google uses a 404 for missing pages and says single-page apps may find meaningful status codes impossible or impractical. Its suggested workarounds are a redirect to a server URL that returns a 404, or a noindex robots meta tag added with JavaScript.
Sources
- Understand the JavaScript SEO basics, Google Search Central. Accessed 24 November 2026
- Link best practices for Google, Google Search Central. Accessed 24 November 2026
Further reading
-
robots.txt and noindex are different controls
robots.txt decides which URLs crawlers may fetch, while noindex decides whether a fetched page may appear in search results.
-
The robots meta tag and X-Robots-Tag
Put a robots meta tag in the head of an HTML page and an X-Robots-Tag header on other files, and make sure robots.txt does not block the page.
-
Choosing between 301, 302, 307 and 308 redirects
Use a permanent code when an old address should be retired, and a temporary one only when the original address is meant to return.
Have an idea that should exist? Or a working product that needs more customers, a new website or a complete rework? Bring us anything. Apply with your idea