JavaScript and rendering
Pages built in the browser have to be rendered before search engines see them. What is not in the rendered page is not indexed.
What you will be able to do
Know what Google does with pages built in JavaScript, and avoid the patterns that hide content, links or rules from it.
How it reaches growth
- JavaScript and rendering
- Search engines see the same content and links visitors see
- Every page can be found through links and indexed in full
- Pages rank for what they actually offer
- Organic visits and signups from pages built with JavaScript
What it is
Many products build their pages in the browser with JavaScript. Google says it processes such pages in three phases, crawling, rendering and indexing, and that it uses the rendered HTML to index them.
How it works
Googlebot checks robots.txt first, and does not render blocked pages or files. Pages that answer 200 are queued for rendering unless a robots meta tag or header says not to index them; for other status codes, rendering may be skipped.
Only what is in the rendered HTML can be seen. Links need to be real <a> elements with an href; links added by JavaScript are fine if they are real links. For moving between views, Google recommends the History API rather than fragments in the address.
Two traps concern the rules in a page. Google advises against using JavaScript to change the canonical tag, and says that when it finds noindex it may skip rendering, so removing noindex with JavaScript may not work.
Why it matters for growth
A product built in JavaScript can lose organic growth silently: the team sees full pages in the browser while search engines see empty shells, missing links or a different canonical. Pages that cannot be read cannot rank, however good they are.
How to check it
- Use URL Inspection in Search Console to see the HTML Google rendered for your main templates, and compare it with what visitors see.
- Check that navigation and product links are <a> elements with real addresses.
- Check that canonical tags and robots rules are in the HTML the server sends, not added later.
Rules of thumb
- What matters must be in the rendered HTML.
- Every link a search engine should follow is an <a> with an href.
- Set the canonical tag and noindex in the server's response, not with JavaScript.
Rules of thumb are starting points for a decision, not laws.
Common mistakes
- Links that work only through click handlers, with no address.
- Moving between views with fragments (#) instead of real addresses.
- Showing a not-found view in a single-page app while answering 200.
A worked example
A made-up recipe site rebuilt its category pages as a single-page app. They looked richer, but each recipe opened through a click handler with no address, so search engines found no links from categories to recipes, and new recipes had to be found through the sitemap alone.
Suppose that delayed each new recipe's arrival in search by two weeks. The site adds 100 recipes a month, and a new recipe earns 300 visits in its first month: losing half of that first month is about 15,000 visits a month, which at one newsletter signup per 80 visits is nearly 190 signups a month.
The business and its numbers are made up to show the arithmetic.
Apply it
The simulations for this topic are being made.
Get one email when it is out, and use the steps below on your own product meanwhile.
On your own product
- Pick your most important template.
- Inspect it in Search Console and read the rendered HTML.
- Check that the main content, the links and the canonical tag are all there.
Questions
Does Google run JavaScript?
Yes. It renders pages and uses the rendered HTML for indexing, as long as the page and its files are not blocked.
Should the server send the full page?
Sending the main content and links in the first HTML response removes the dependence on rendering. Many teams do it for the pages that must rank.
Do JavaScript redirects work?
Google can follow them, but advises using them only when server-side or meta refresh redirects are impossible, because it may not see them if rendering fails.