What does Google say about SEO? /
Quick SEO Quiz

Test your SEO knowledge in 3 questions

Less than 30 seconds. Find out how much you really know about Google search.

🕒 ~30s 🎯 3 questions 📚 SEO Google

Official statement

For JavaScript links, you must use a real HTML A tag with an href attribute containing a resolvable URL, not a JavaScript URL like 'javascript:'. Avoid anything that isn't an appropriate link.
🎥 Source video

Extracted from a Google Search Central video

💬 EN 📅 07/09/2022 ✂ 17 statements
Watch on YouTube →
Other statements from this video 16
  1. Le balisage Local Business doit-il vraiment se limiter à une seule ville ?
  2. Faut-il vraiment migrer 1:1 sans rien changer lors d'un changement de domaine ?
  3. Schema.org : pourquoi Google ignore-t-il une partie de vos balises structurées ?
  4. Faut-il vraiment rédiger du texte descriptif autour de vos illustrations pour ranker dans Google Images ?
  5. Faut-il publier tous les jours pour améliorer son référencement Google ?
  6. Le nombre de mots est-il vraiment sans importance pour le référencement ?
  7. Les mots-clés dans les URLs ont-ils encore un impact en SEO ?
  8. Les images consomment-elles vraiment du budget de crawl au détriment de vos pages stratégiques ?
  9. Peut-on vraiment lancer deux sites quasi-identiques sans risquer de pénalité Google ?
  10. L'audio sur une page influence-t-il réellement le classement Google ?
  11. Faut-il vraiment éviter de modifier les balises meta avec JavaScript ?
  12. Les mises à jour algorithmiques de Google sont-elles vraiment différentes des pénalités ?
  13. Pourquoi Google ne communique-t-il que sur une fraction de ses mises à jour d'algorithme ?
  14. Les données structurées améliorent-elles vraiment votre classement dans Google ?
  15. Faut-il vraiment éviter d'utiliser noindex et canonical sur la même page ?
  16. Les données structurées vidéo servent-elles uniquement à l'indexation ?
📅
Official statement from (3 years ago)
TL;DR

Google requires standard HTML <a> tags with an href attribute containing a real URL — not pseudo-links with 'javascript:' or onclick without href. Poorly implemented JavaScript links are simply not followed correctly by Googlebot, even if the engine executes JS. Always use href with a functional destination URL, even if you add JavaScript on top of it.

What you need to understand

Why does Google insist so much on A tags with valid href?

The answer comes down to one word: reliability. Googlebot discovers links by parsing raw HTML before executing any JavaScript. If your link doesn't exist in the initial DOM as <a href="URL">, you're taking an unnecessary risk.

Even though Google executes JavaScript — and it does — the process isn't instantaneous. The engine must wait for loading, execution, then analyze the modified DOM. A link present from the initial HTML is discovered immediately, with no dependency on JS budget or execution errors.

What exactly is a problematic 'JavaScript link' in practice?

Anything that isn't an <a> tag with an href pointing to a valid HTTP(S) URL. Typical cases: <a href="javascript:doSomething()">, <div onclick="navigate()">, or even <a> tags without href at all, entirely controlled by JS events.

These patterns force Googlebot to rely exclusively on JavaScript execution. If the script fails, if JS crawl budget is exceeded, or if rendering is partial — your link simply doesn't exist for the engine.

Does Google follow these malformed links anyway?

Sometimes yes, often no. Google can discover certain URLs through JS execution or other sources (sitemaps, backlinks). But you lose control: no guaranteed discovery, no predictable PageRank transmission, no clear anchor text signal.

Let's be honest: why bet on random engine behavior when the solution — using an href — takes 30 seconds to implement?

  • <a> tag required — no div, span, or other repurposed element
  • href attribute with valid URL — HTTP(S), not javascript: or #
  • Guaranteed discovery from HTML — independent of JS execution
  • Reliable PageRank transmission — Google treats these links as standard signals
  • Exploitable anchor text — the engine understands the semantic context of the link

SEO Expert opinion

Is this recommendation actually followed by major sites?

No. Many high-traffic sites still use non-compliant JavaScript patterns — and get away with it. Amazon, Airbnb, major SaaS platforms have links driven by JS without valid href. Why? Because they benefit from massive crawl budget, solid external linking, and Google invests more JS resources on them.

But here's the trap: what works for a site with 10 million monthly visits doesn't work for you. Your JS budget is limited, your authority too. You don't have the luxury of counting on Google's goodwill.

What nuances should be applied to this rule?

Martin Splitt says "use href," but doesn't specify what happens if you have both href AND an onclick event that modifies behavior. Typical case: <a href="/page" onclick="trackEvent()">. Does this pass?

Yes, as long as the href points to a valid URL. Google follows the href in the initial HTML, ignores the onclick event for link discovery. JS can enrich user experience (tracking, animations) without breaking SEO — provided the link works without JS.

[To verify]: Google doesn't explicitly document behavior with href attributes dynamically modified by JS after loading. If your script changes the destination URL after initial rendering, nothing guarantees Googlebot will follow the modified version rather than the original.

In which cases does this rule not apply strictly?

Interactions that are not navigation links. Action buttons (open a modal, submit a form, trigger an animation) don't need to be <a> tags. A <button> with onclick is perfectly legitimate — as long as it doesn't lead to a new page you want indexed.

The problem arises when developers use buttons or divs for what should be a link. If it leads to indexable content, it's an <a href>. End of story.

Warning: Modern JS frameworks (React, Vue, Angular) often generate navigation components that look like links but aren't. Check the final rendered HTML — not the React source code. If the DOM doesn't contain <a href>, you have a problem.

Practical impact and recommendations

What should you do concretely on an existing site?

Audit your navigation links. All of them. Use a tool like Screaming Frog with JavaScript enabled/disabled mode and compare discovered links in both cases. If critical URLs only appear in the JS crawl, you have an issue.

Manually inspect a few key pages with Chrome DevTools. Disable JavaScript (Settings > Debugger > Disable JavaScript) and reload. Do your navigation links still work? If not, they're not reliable for Googlebot.

How do you fix problematic JavaScript links?

Replace anything that isn't an <a> with a real HTML link. If you're using onclick for navigation, convert to <a href="URL" onclick="function()"> and ensure the href points to the correct destination.

For JS frameworks: configure your router to generate real <a> tags. React Router, Vue Router, and Angular Router do this by default — but verify your custom components don't override this behavior. A React <Link> must produce an <a href> in the final DOM.

If you absolutely must use JavaScript for navigation (complex single-page apps), implement at minimum a working href fallback. Even if users never see it, Googlebot must be able to follow that link without executing a line of JS.

  • Crawl the site with JS disabled and list missing links
  • Replace href="javascript:" with valid HTTP(S) URLs
  • Convert div/span onclick to real <a> tags
  • Verify each navigation link has a working href, even if JS enriches behavior
  • Test initial HTML rendering (View Source) vs final DOM (Inspect Element) to detect links only generated by JS
  • Audit framework components (React Router, Vue Router) to confirm they produce <a href>
  • Implement automated tests that verify the presence of valid href on critical links
Fixing JavaScript links may seem minor, but it often touches your site's front-end architecture — frameworks, reusable components, navigation logic. If these changes seem complex or risky to implement alone, support from a technical SEO agency can save you precious time and prevent costly regressions. A targeted code review and rendering tests validate that your fixes work without breaking user experience.

❓ Frequently Asked Questions

Est-ce qu'un lien avec href='#' et un onclick qui redirige est acceptable pour Google ?
Non. Un href='#' ne pointe vers aucune URL valide, donc Googlebot ne peut pas suivre le lien via le HTML initial. Même si le onclick fonctionne côté utilisateur, le moteur n'a aucune garantie de découvrir la page de destination. Utilisez toujours un href avec l'URL réelle.
Les liens générés dynamiquement par JavaScript après le chargement sont-ils suivis par Google ?
Parfois, si Googlebot exécute le JS et que le budget crawl le permet. Mais c'est un pari risqué. Un lien absent du HTML initial peut être ignoré ou découvert avec retard. Pour les pages importantes, assurez-vous qu'elles sont liées dès le DOM initial.
Comment vérifier si mes liens sont bien des balises A avec href valide ?
Inspectez le code source HTML brut (Ctrl+U ou View Source) et cherchez vos liens de navigation. Ils doivent apparaître sous forme <a href='URL'>. Si vous ne les voyez que dans l'inspecteur d'éléments (DOM final), ils sont probablement générés par JS, ce qui pose problème.
Un site React ou Vue peut-il être SEO-friendly avec cette contrainte ?
Oui, à condition d'utiliser le server-side rendering (SSR) ou la génération statique pour que les liens <a href> soient présents dans le HTML initial. Next.js, Nuxt.js et Angular Universal gèrent ça automatiquement. Sans SSR, vous dépendez entièrement de l'exécution JS côté Google.
Que se passe-t-il si un lien a un href valide mais que JavaScript change la destination au clic ?
Google suit le href du HTML initial pour la découverte et le crawl. Si le JS modifie l'URL après coup, le moteur ne voit que la version originale. Pour le SEO, seul le href initial compte — le comportement JS est invisible pour Googlebot.
🏷 Related Topics
AI & SEO JavaScript & Technical SEO Links & Backlinks Domain Name

🎥 From the same video 16

Other SEO insights extracted from this same Google Search Central video · published on 07/09/2022

🎥 Watch the full video on YouTube →

Related statements

💬 Comments (0)

Be the first to comment.

2000 characters remaining
🔔

Get real-time analysis of the latest Google SEO declarations

Be the first to know every time a new official Google statement drops — with full expert analysis.

No spam. Unsubscribe in one click.