A navigation item can trigger a page change in a browser and still fail to provide a dependable link for a crawler. This happens when a click handler calls a route but the HTML contains no normal link element with an href. The technical check is not only whether a person can click the menu.
Google can generally extract URLs from an HTML <a> element with a resolvable href. Google's link best practices explain why a JavaScript function alone is not the same thing. JavaScript can insert links into the page, but the result still needs to be a regular link element with a valid URL.
This guide focuses on internal links and client-side navigation. It does not cover JavaScript rendering in general or canonical and status-code problems. If the markup appears only after load, the check still needs to include the rendered page.
Link or click action: the difference in HTML
A link describes a destination. A button triggers an action. JavaScript can style both in the browser, but the HTML distinction still matters.
A navigation item like this depends entirely on an event:
html<button
Running shoes
</button>
The browser can run the action when someone clicks. But the element does not contain a destination URL for a crawler to extract as a link. A <div data-url="/shoes/running"> does not become a regular link just because a click handler is attached to it.
For navigation, a real href is a better foundation:
html<a href="/shoes/running">Running shoes</a>
The URL is available before any click handler runs. JavaScript can build on it, for example by adding animation or client-side routing. If JavaScript fails, the browser can still open the link normally. This also helps with keyboard use, opening new tabs and other user agents.
Adding an onclick handler to a link with an href does not automatically make it unusable. The important part is to keep a real, resolvable URL in the href and avoid JavaScript that blocks every normal navigation. An element such as <a> without an href does not provide that foundation.
What Google says about JavaScript pages
Google describes three phases: crawling, rendering and indexing. On the initial fetch, Googlebot reads the HTML response and can find links in href attributes. A JavaScript page may then be rendered. Google also parses the rendered HTML and can discover more links there. This does not mean every link is available on the first request.
Google's JavaScript SEO basics explain that JavaScript may insert links into the page if the result follows the usual link rules. The rendered result still needs to be a usable <a href="...">. A click event on a text node does not replace that element.
For a simple content page, the difference is often easy to see: the HTTP response either includes the navigation or it does not. A single-page app may return only an empty app shell at first. The application then has to run, load data and insert its navigation into the DOM before Google can read the links from the rendered HTML. Other crawlers may not execute JavaScript, or may do so differently.
So you do not need to ban JavaScript from links. You do need to know whether a target URL is in the HTTP response or appears only after several client-side steps. The more steps involved, the more failure points belong in the check.
URLs in a single-page app
A fragment such as #/products/running changes the view while the part after # is not sent to the server. Google warns against using URL fragments as a replacement for real page paths. Its JavaScript SEO documentation recommends the History API for client-rendered views.
A reliable starting point is a regular URL:
html<a href="/products/running">Running shoes</a>
The app can intercept the click, update the view and change the URL with history.pushState. The href still matters. pushState alone does not create links on the page or expose a destination for extraction.
Also test whether the address works when loaded directly. If someone opens /products/running in a new tab, the server or app should provide the same view. A link that works only after another view has been opened may depend on a routing or loading state that a crawler does not have.
JavaScript may add links, but the sequence must work
Google can use JavaScript to insert links into a DOM when the result follows ordinary link rules. That can be useful for dynamic menus, filters or result lists. A link that appears only after a user action, consent, sign-in or failed API request is harder to extract reliably.
Check when the link appears. A category may be rendered only after an API response. If that request fails, a navigation path to the products may be missing. If the page depends on a cookie or storage state, the rendered view may differ from what an ordinary visitor sees.
Check these points:
- Is the destination in the initial HTML, or does it appear only after rendering?
- Is the final element an
<a>with a complete or relativehref? - Can the URL be opened directly and return a useful page?
- Does the API request complete without requiring a user action?
- Can Googlebot fetch the resources that create the menu?
- Does normal link navigation still work when JavaScript or an extra script fails?
Better internal linking can connect important pages to the existing topic structure. It helps only when the rendered markup actually contains a link. Very large sites may also need to assess crawl budget separately. A missing href does not prove there is a crawl-budget problem.
A concrete check for a category menu
Imagine a shop category with links to Running shoes, Hiking boots and Sandals. A browser crawl of the home page finds one button called “Categories”. A person can open the menu. The crawler still finds none of the destination URLs.
First inspect the HTTP response for the home page. If it contains only a button with no href, find the client-side code that creates the subcategories. Then inspect the rendered page, not just its source code. The URL Inspection tool in Search Console can show a rendered view, HTML, loaded resources and JavaScript output for accessible URLs.
If the destinations appear there as links, inspect each href. href="/category/shoes/running" is a resolvable internal address. href="javascript:openCategory('running')" is not a normal destination URL. A fragment such as href="#/category/shoes/running" is not a good foundation for a distinct page URL.
If no link appears in the rendered HTML, check resource errors and console messages. Google's guide to fixing JavaScript-related Search problems recommends inspecting the rendered state. A local browser view helps too, but does not prove that Google could fetch the same resources.
A technical site audit overview can be a useful next step when you want to connect navigation checks with other crawling and indexing findings. The check of one menu still needs to happen against the actual DOM and target URLs.
Inspect raw HTML and rendered DOM together
Compare the server response with the rendered DOM for the same source page. A missing link in the raw response alone does not prove a problem if the page reliably inserts it later. If the link is missing from the rendered DOM too, that test did not expose it as a link.
If the link appears later, ask what triggers it. Does the menu render automatically, or only after someone clicks “Load more”? Must a visitor first select a region, language or category? A later interaction adds another state to the discovery path.
You can also use a site crawler to inspect the internal URLs it actually extracts. Compare a JavaScript-rendered crawl with a non-rendered fetch. A difference shows which links depend on rendering. It does not prove Google will use the same crawl order or fetch the same resources.
If a URL is still missing after this check, separate link discovery from indexing. The crawled but not indexed guide covers a later state. An href shows that a link destination is offered. It does not promise that Google will crawl it, select it as canonical or index it.
Common misreadings
- “The menu works, so it is a link.” A click handler can navigate without providing an
href. - “Google runs JavaScript, so it sees every link.” Google can render JavaScript, but the resources and code still have to work and the result must contain a link element.
- “The link appears in my local browser.” That shows what your browser rendered. URL Inspection may add evidence about Google's inspection, but neither is proof of a later crawl or indexing.
- “A
pushStatecall is enough.” It changes browser history. It does not create a clickable link element with anhref. - “An
hrefmeans the destination will be indexed.” The target still has to be accessible, indexable and suitable for the relevant search. - “Every crawler works like Google.” JavaScript support and rendering behavior vary between systems.
A short release checklist
Before a frontend release, check important menus and lists against the same questions:
- Does every navigation item render as a real
<a>element with anhrefthat resolves to a normal URL? - Do client-side routes stay connected to addresses that can load directly?
- Do links appear in the rendered DOM without an extra user action?
- Do required scripts and data load successfully?
- Can a visitor open the target in a new tab, and can a crawler fetch the destination independently?
- Do reports distinguish between link present, URL discovered, URL crawled and URL indexed?
Deep navigation also needs useful links from categories to subcategories and products. Anchor text should describe its destination. That helps people navigate and makes the relationship clear. It does not replace checking whether the target exists in the DOM and in the href. The SEO audit checklist shows how to place a link check within a broader technical review.
If the link exists but the target page is missing, check its status, access, robots.txt, noindex and canonical URL. Indexing is a separate state that navigation cannot guarantee. If a rule in robots.txt blocks the target, a visible link does not remove that restriction.
Questions about JavaScript navigation
Must every internal link be in the first HTML response?
Not necessarily. Google can find regular links after rendering when JavaScript runs successfully and creates a normal a element with an href. Links in the initial HTML avoid an extra rendering dependency and work for crawlers that do not execute JavaScript.
Is a button with onclick always wrong?
No. Buttons are useful for actions such as opening a menu or showing options. A navigation destination should be exposed as a link with an href. A click handler can add convenience.
Does URL Inspection prove that a page is indexed?
No. URL Inspection shows indexed data and can run a separate live test. The live view helps show what Google fetched and rendered for that test. It does not guarantee a later crawl or indexing.
The quickest first check is simple: look for the destination path in the HTML and rendered DOM. If it appears only in JavaScript code or a click handler, there is no normal link. If an <a href> is present, check the destination's accessibility and indexing separately.