Technical SEO Links

JavaScript Rendering and Links: What Google Can and Can't Follow

By BacklinkPrice Team · Nov 22, 2026 · 6 min read
Cover image for JavaScript Rendering and Links: What Google Can and Can't Follow

Why JavaScript-built navigation and related links can go unseen, which link formats Google follows, and how to keep important links crawlable.

JavaScript affects links because Google only reliably discovers links that are a elements with an href attribute, and links added by JavaScript may only be found after rendering, which can be delayed. Put important links in the initial HTML, use real hrefs instead of click handlers, avoid hash-fragment URLs, and test what Google actually sees.

Modern sites often build navigation, related posts and product grids with JavaScript. That can be fine, but it's also one of the most common reasons important pages go undiscovered.

Key takeaways

  • Google processes JavaScript sites in three stages: crawling, rendering and indexing.
  • Google can only discover links that are a HTML elements with an href attribute.
  • Links that rely on onclick handlers or other script events may not be extracted.
  • Google's guidance recommends the History API over URL fragments for app-style navigation.
  • Server-side rendering or static HTML for key links removes most of the risk.
Link formatCan Google follow it?Recommendation
a element with href="/page"YesUse this
a element with href and an onclickYes, via the hrefFine
a element with no href, only onclickNot reliablyAvoid
span or div with an href attributeNoAvoid
href="#/page" fragment routingNot as a separate pageUse the History API
Link added by JS after renderingYes, after renderingPrefer initial HTML for key links

How Google processes JavaScript

Crawl, render, index.

Google's JavaScript SEO basics describe three main phases: crawling, rendering and indexing. Googlebot parses the HTML response for links in href attributes and adds them to the crawl queue.

Links that only appear after JavaScript runs are found later, once the page is rendered. Sitebulb's guide on whether Google can crawl JavaScript links explains that this rendering delay is a big part of why JavaScript has a difficult reputation in SEO.

What Google can and can't follow

An href is non-negotiable.

Google's link best practices state that Google can generally only crawl a link if it's an a element with an href attribute. It can't reliably extract URLs from a elements without an href, or from other tags that act as links through script events.

The examples are clear: a span with an href, or an a element with only an onclick handler, are not recommended. An a element with a real href plus an onclick is fine, because the href is still there.

Lumar's notes from Google's office hours report that Google doesn't handle all onclick events, and advise making sure the DOM contains normal elements with href links.

Fragment URLs

Hash routes look like one page.

Single-page apps sometimes use URLs like example.com/#/products. Google's JavaScript guide recommends using the History API instead of fragments, so each view has a proper URL that can be linked, crawled and indexed.

Navigation built with click handlers.

Search Engine Journal's JavaScript SEO guide describes an audit where navigation links didn't follow web standards, so Google couldn't see or follow them and traffic collapsed.

Related posts and product grids loaded on scroll. If cards only appear after scrolling and lack real hrefs, deep pages may lose internal links. Our guide on finding internal linking opportunities helps add static links as a backup.

Links blocked by robots.txt. If the JavaScript files that build links are blocked, Google can't render them.

Load more buttons without URLs. Content behind a button with no paginated URL may never be crawled.

1. Put key links in the initial HTML.

Main navigation, category links, breadcrumbs and important in-content links should be in the server response, not added later. That way Google finds them during the first crawl.

2. Use real a elements with hrefs.

Keep click handlers if you need them, but always include a proper href to a real URL.

3. Use server-side rendering or static generation where possible.

Ahrefs' guide to JavaScript SEO notes internal and external links need an a tag with an href attribute, and discusses rendering approaches that make content available sooner.

4. Give every view its own URL.

Use the History API so each product, article or filter state that should be indexed has a real, linkable URL.

5. Don't block resources needed to render links.

Our guide on building internal links covers where key links should sit on a page.

Allow Google to fetch the JavaScript and API responses that build your link lists.

Undiscovered links pass nothing.

Internal links spread value between your pages and help Google understand which pages matter. If Google can't find a link, the page it points to loses that support. Our guide on whether internal links help SEO explains how much this can matter.

The same applies to links you want to be followed. A link that only exists after a script runs might be found late or not at all, even if it would otherwise count. Our guide on whether internal links should be dofollow covers the attribute side of the question.

For backlinks, the issue is usually on the linking site. If a partner's page adds your link with JavaScript, it may take longer for Google to credit it. Where you can, ask for links placed directly in the page content.

How to test what Google sees

Compare raw HTML with the rendered page.

View the page source to see links in the initial HTML. Then use Search Console's URL Inspection tool to view the rendered HTML Google sees. Links present only in the rendered version depend on rendering.

Run a crawler with and without JavaScript rendering. Pages that appear only in the rendered crawl rely on JavaScript links. Pages that appear in neither may be orphaned; our guide on fixing orphan pages covers next steps.

What about AI crawlers?

Many don't render JavaScript.

Some AI crawlers fetch raw HTML without running scripts. Links that exist only after rendering may be invisible to them. Our guide on whether AI crawlers follow links explains why initial-HTML links matter for AI visibility too.

Frequently Asked Questions

Yes, if they're a elements with an href and Google can render the page. Links created only with click handlers may not be followed.

They can, once Google renders the page and finds them. Links in the initial HTML are discovered sooner and more reliably.

Are hash URLs bad for SEO?

URL fragments aren't treated as separate pages. Google recommends the History API so each view has a real URL.

Use Search Console's URL Inspection tool to view the rendered HTML, and compare crawls with and without rendering.

Should navigation be built with JavaScript?

It can use JavaScript for behaviour, but the links themselves should be real a elements with hrefs in the initial HTML.

Sources

BacklinkPrice Team
Written by
BacklinkPrice Team
Link building and backlink pricing research

The BacklinkPrice Team researches backlink prices, publisher sites and link building tools. We check prices and plans against each provider's own pages and date them, so you know how current the numbers are.

More from BacklinkPrice Team

Related guides