JavaScript Link Onclick Issue

JavaScript Link Onclick Issue

Free Complete Site Audit

Access a full website audit with over 300 technical insights.

Something went wrong. Please, try again later.
Trusted by
Sitechecker trusted company

Free Website SEO Checker & Audit Tool

  • Scan the site for 300+ technical issues
  • Monitor your site health 24/7
  • Track website rankings in any geo

The issue notification remarks that a particular URL contains at least one outgoing anchor link with the URL in the onclick attribute.

What Does “JavaScript Link Onclick” Mean?

When using JavaScript links, there is a good chance that search engines (most likely other than Google) will not follow the references. If you work below Google, this probably won’t be a problem for you.

What Triggers This Issue?

An issue notification will be triggered for any internal URL that contains an outgoing link with the URL in the onclick attribute.

The presence of JavaScript: in any attribute not intended for scripting is a deprecated HTML method. While it does work in practice, you’re still assigning JavaScript properties to a non-script attribute, which is not good practice.

It’s best to add JavaScript to the onclick attribute, which is ignored if you can’t create scripts.

How to Check the Issue?

Crawlers (special tools for web admins) can check this specific issue. In the report, after scanning, the JavaScript Link Onclick issue will be marked as not serious.

It will not do any harm to your site. Nevertheless, it is considered an error and is placed in the scan report to notify the site owner.

Sitechecker also scans for issues of this nature, labeling them as “Notices”.

Onclick Attribute Issue

The service even allows you to find this issue in the code of every specific page.

Onclick Attribute Code

Why is This Important?

And although it’s considered just a notification and not a serious error, you should know why it’s important. For a JavaScript link, the onclick attribute specifies the JavaScript action when the user clicks the link (the onclick event for the link happens), and the URL is present in the onclick attribute.

The purpose of the link defines in JavaScript, which can cause problems for search engine robots. Of all the search engines out there, Google handles JavaScript rendering the best. Google sometimes claims to solve the problem with such links.

Fixing pages having link with a URL in onclick attribute is good for your website but not enough to get good SERP positions!

To detect not only the issue but other kind of site level and page level problems, just make the full site audit.

Something went wrong. Please, try again later.

How to Fix the Issue?

This issue is simply an alert. You do not have to solve the problem immediately. SEO optimization software simply informs web admins about the error.

Search engines are getting better at interacting with JavaScript every day, but the problem of link handling is still relevant.

You can only conclude whether your JavaScript links work for the search engines by analyzing the link log. Here are a few ways to fix the bug:

  1. Make sure there’s a spare HTML link if you’re leaving JavaScript behind;
  2. Replace JavaScript links with HTML references so that they are accessible to most search engine robots;
  3. If your site’s content relies heavily on JavaScript, you can try serving processed pages to the search engines yourself.
Fast Links

You may also like

View More Posts
Sitemap.XML Not Indicated In Robots.TXT: Laying the Foundation
Site Audit Issues
Sitemap.XML Not Indicated In Robots.TXT: Laying the Foundation
Ivan Palii
Feb 14, 2024
How to avoid an excessive DOM size?
Site Audit Issues
How to avoid an excessive DOM size?
Iryna Krutko
Jan 5, 2023
How to fix URLs with canonical to non-200
Site Audit Issues
How to fix URLs with canonical to non-200
Ivan Palii
Apr 18, 2024
close