org.sonar.l10n.web.rules.Web.LinkToNothingCheck.html Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sonar-web-plugin Show documentation
Show all versions of sonar-web-plugin Show documentation
Enables scanning of HTML, and JSP/JSF files.
The newest version!
There are two ways to build a link that has the sole purpose of running JavaScript code. The goal of this rule is to ban such patterns in order to
support browsing with JavaScript disabled.
Noncompliant Code Example
<a href="#" onclick="alert('Clicked!'); return false;">Run JavaScript Code</a> <!-- Noncompliant -->
<a href="javascript:void(0)" onclick="alert('Clicked!'); return false;">Run JavaScript Code</a> <!-- Noncompliant -->
<a id="inPageAnchor">Jump down the page to me</a> <!-- Compliant -->
Compliant Solution
<a id="inPageAnchor">Jump down the page to me</a> <!-- Compliant -->
© 2015 - 2024 Weber Informatics LLC | Privacy Policy