
onclick JavaScript handler instead of a real href, search engines usually will not treat it as a link. The fix is boring but non-negotiable: put the URL in an <a href>. Everything else is a workaround for a problem you created.What "Link URL in OnClick" actually means
You have a clickable element that sends a user somewhere, but the destination URL is not in the anchor's href attribute. Instead it lives inside a JavaScript click handler. Classic shapes of this look like:
<a href="#" onclick="location.href='/pricing/'">Pricing</a>
<span onclick="window.open('/pricing/')">Pricing</span>
<div class="card" onclick="goTo('/pricing/')">Pricing</div>
<button onclick="navigate('/pricing/')">Pricing</button>To a human with a mouse, all four behave the same: click, arrive at the pricing page. To a crawler reading the raw HTML, three of them are dead ends and the first one points at # (the current page). The real URL is trapped in script that the crawler may never execute the way a browser does.
Why this quietly wrecks crawling and link equity
Googlebot renders pages, so people assume onclick navigation "works for SEO." It sometimes does and often does not, and betting your internal linking on "sometimes" is a bad trade. Here is what is really going on:
- Discovery. Google's own documentation is explicit: it follows links only when they are
<a>tags with anhrefattribute. Aspanordivwith an onclick is not a link in their eyes, even after rendering. If a page is reachable only through onclick handlers, it may never be found. - PageRank flow. Even when a URL gets crawled through some other path, a non-href "link" passes no internal link signal. Your money pages stop receiving the internal equity you think you are sending them.
- Rendering is not guaranteed or free. Rendering happens on a delay and on a budget. Relying on JavaScript execution to expose your navigation means slower discovery at best and missed pages at worst.
- Accessibility collapses too. A
div onclickis not keyboard focusable, exposes no destination to screen readers, and breaks middle-click, open-in-new-tab, and "copy link address." This is the same root cause hurting both SEO and real users.
The spectrum: from invisible to fully crawlable
How to detect it
| Tool | How to find onclick navigation |
|---|---|
| View source / DevTools | Search the raw HTML for onclick. Anything with a URL inside that is not backed by an href is a suspect. |
| Screaming Frog | Crawl with JavaScript rendering off, then on. Pages that appear only in the rendered crawl are likely reachable only through scripted navigation. |
| Sitebulb | Compares rendered vs raw links and flags links that exist only after JavaScript runs. |
| Search Console URL Inspection | Use "View crawled page" to see the rendered HTML Google stored, and check whether your target links resolve to real anchors. |
| Server logs | If Googlebot never requests a URL that should be internally linked, the link it depends on probably is not a real anchor. |
How to fix it, step by step
- Find the destination. Read the onclick handler and pull out the actual URL it navigates to.
- Put it in an anchor. Replace the element with
<a href="/real-url/">Label</a>. If it was adivorspanacting as a button, make it a genuine anchor. - Keep JavaScript only if it adds behavior. Analytics, SPA routing, or a modal are fine as an enhancement layered on top of a working href. The pattern is
<a href="/pricing/" onclick="track(); return spaRoute(event)">, where the href is the source of truth and JS is optional polish. - Never use
href="#"orhref="javascript:void(0)"as the real link. Those tell the crawler the destination is the current page or nothing. Put the actual path in. - Re-crawl and confirm. Run Screaming Frog again with rendering off. Your previously hidden pages should now appear as normal internal links.
DO
- Put every real destination in an
<a href> - Use JavaScript as an enhancement on top of a working link
- Keep middle-click and open-in-new-tab working
- Make card-style clickable blocks wrap a real anchor
- Re-crawl with rendering off to confirm links are visible
DON'T
- Hide URLs inside
onclickwith no href - Use
href="#"orjavascript:void(0)as the destination - Make
divorspanelements your primary navigation - Assume rendering will always rescue you
- Route important internal links through scripted handlers only
What "good" looks like
Open the page, disable JavaScript, and click your main navigation and internal links. If they still work, you are done. Every important destination resolves from a plain anchor in the raw HTML, JavaScript adds tracking or transitions without being load-bearing, and a rendering-off crawl surfaces the same link graph a rendering-on crawl does. When those three things are true, crawlers see what users see and your internal equity flows where you intend.
FAQ
Does Google not just render the JavaScript and follow it anyway?
<a href> tags as links for discovery and PageRank. A scripted onclick navigation is not a link even after rendering, so it may be crawled through another path or not at all, and it passes no internal link signal.Is it fine to keep the onclick if I also add a proper href?
My whole-card click uses onclick. How do I fix that without redesigning?
Does this hurt accessibility as well as SEO?
div onclick is not keyboard focusable, announces no destination to screen readers, and breaks open-in-new-tab and copy-link. Fixing it with a real anchor solves the SEO and the accessibility problem at once.Not sure how many of your internal links are trapped in JavaScript?
An audit that compares your rendered and raw crawls will show exactly which pages are reachable only through scripted navigation, and what it is costing your internal linking.
Claude Vincent is a technical SEO consultant focused on crawlability, rendering, and AI-search visibility. He writes the field guides and case studies at SEO ProCheck, with a bias toward the durable, unglamorous work that decides whether search engines and AI answer engines can actually read and cite a site.
About SEO ProCheck
Technical SEO consulting and GEO strategy with 20 years of enterprise experience. Case studies, resources, and tools for search and AI visibility.
Work With Me
Technical SEO audits, GEO strategy, site migrations, and international SEO. Hourly consulting for teams who need hands-on support, not just reports.







