JavaScript SEO: Can Google Access Your Website's Main Content?

JavaScript SEO: Can Google Access Your Website's Main Content?

Usually yes – Google runs JavaScript in a headless Chromium browser – but not instantly, not in every situation, and many other crawlers don't run it at all. The safe setup for a business website is simple: the main text, links, title and canonical address are in the HTML your server sends, and JavaScript adds interactivity on top. You can check your own pages in about ten minutes with the steps below.

How Google handles JavaScript pages

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

  1. Crawling. Googlebot checks robots.txt, fetches the HTML and collects links from href attributes. If robots.txt disallows a URL, Googlebot doesn't request it – and Google won't render JavaScript from blocked files.
  2. Rendering. Pages that return a 200 status code are queued for rendering. Google says a page may stay in this queue for a few seconds, but it can take longer; once resources allow, a headless Chromium renders the page and executes the JavaScript. Pages with other status codes, such as 404 error pages, might not be rendered at all.
  3. Indexing. Google parses the rendered HTML for more links and uses it to index the page.

So content that appears only after JavaScript runs can be indexed, but it depends on the second step working. Sites built on an "app shell" – where the first HTML contains almost nothing and scripts draw the whole page – depend on it entirely.

Where JavaScript sites usually go wrong

ProblemWhat happensFix
Navigation made of clickable elements without hrefGoogle discovers links only from <a> elements with an href attributeUse real links for every page you want found
Pages addressed with fragments, such as #/servicesGooglebot can't reliably resolve such URLsUse normal paths and the History API
Content loaded only after scrolling, clicking or typingGoogle Search does not interact with your pageLoad content when it is visible in the viewport, or put it in the HTML; give each chunk of an endless list its own URL
noindex in the original HTML, removed later by JavaScriptGoogle may skip rendering when it sees noindex, so the page can stay out of the indexIf you want the page indexed, don't put noindex in the original code
Missing pages that say "not found" but return status 200Soft 404 errorsRedirect to a URL that returns 404, or add noindex to error views
Content that needs a permission, cookies or stored dataGooglebot declines permission requests, and local storage, session storage and cookies are cleared between page loadsShow the main content without any of these
Old scripts after an updateGoogle's renderer may ignore caching headers and use outdated JavaScript or CSSPut a content hash in file names (fingerprinting)
Canonical address set or changed by JavaScriptConflicting signalsSet it in the HTML; if JavaScript sets it, keep the same value and only one canonical tag

Google isn't the only visitor that matters

Google's own guide says server-side rendering or pre-rendering is still a great idea, because it makes a site faster for users and crawlers, and because not all bots can run JavaScript. That matters more now that AI assistants also fetch web pages. In a December 2024 analysis of crawler traffic, Vercel and MERJ found that none of the major AI crawlers they examined rendered JavaScript. The exceptions they named were Google's Gemini, which uses Googlebot's infrastructure, and Applebot, which uses a browser-based crawler. Crawler behaviour changes, so treat this as a snapshot – but if your content exists only after scripts run, some systems will see an almost empty page.

Rendering options in plain language

ApproachWhat it meansUsually a good fit for
Static renderingThe HTML for each URL is produced in advance, when the site is builtBrochure sites, blogs, documentation
Server-side renderingThe server builds the HTML for each requestMost business sites, shops, catalogues
HydrationScripts in the browser make server-rendered HTML interactiveSites built with JavaScript frameworks that also need search visibility
Client-side renderingThe browser builds the page with JavaScriptApplications behind a login: dashboards, admin panels, CRM

The web.dev guide to rendering notes that client-side rendering can work for search, but often needs additional testing and overhead, and that the amount of JavaScript tends to grow as an application grows, which can hurt responsiveness. Google describes dynamic rendering – serving crawlers a separate pre-rendered version – as a workaround and not a recommended solution, and recommends server-side rendering, static rendering or hydration instead.

The balanced view: an application your customers use after logging in doesn't need to be in Google at all, so client-side rendering is perfectly reasonable there. Public pages meant to bring customers from search are a different matter.

A ten-minute check for your own site

  1. View the source. Open an important page, press Ctrl+U (or choose "View page source") and search for a sentence from the main text. If it's there, the content is in the HTML. If the source is mostly scripts and an empty container, the page depends on rendering.
  2. Look at what Google rendered. In Search Console, the URL Inspection tool shows the page as Google loaded it. Without Search Console access, Google's Rich Results Test works for any public URL. Both show the loaded resources, JavaScript console messages and the rendered DOM; check that the main text, links and title are there.
  3. Check the links. In the source, menu items and links to service pages should be <a href="..."> elements pointing to normal addresses.
  4. Check a missing page. Open a made-up address on your site and look at the status in your browser's developer tools (Network tab). It should be 404, not 200 with a "not found" message.
  5. Scroll and click. If important content appears only after a click on a tab or a "load more" button, ask whether it is also in the HTML or reachable through its own URL.

Questions to ask your developer

  • Is the main content of public pages in the HTML the server sends, or added by JavaScript?
  • Do all navigation and content links use <a href> with normal URLs, without # routes?
  • Do missing pages return a 404 status code?
  • Are the title, meta description and canonical tag in the initial HTML?
  • Does robots.txt allow the scripts, styles and data the public pages need?
  • How are script files named, so that Google picks up new versions after a change?

When you don't need to worry

If the source of your pages already contains the text, links and titles, and JavaScript only runs the menu, sliders, forms or a cookie banner, JavaScript isn't your search problem. And if the check shows that everything important is visible, there is no reason to rebuild a working site just to switch to another rendering approach. Spend the effort where the check shows a gap. If pages are missing from Google for other reasons, start with why your website is not showing up on Google.

Getting the foundation right

If your check shows that important public pages depend entirely on JavaScript, the fix is usually in how the templates are built, not in the texts. We write our own code for the websites we build and can rework public templates so the main content is in the HTML from the start. For applications behind a login, web-based software can use whatever approach serves its users best. Contact us with links to the pages you are unsure about.

Sources

← All articles

Have an idea for a website, app or system?

Tell us briefly what you need – we will get back to you for a short call and a clear quote.