Element

a

Error Type

Known

Guidelines

Requirement

Anchor must not use Javascript URL protocol.

Error

Anchor using Javascript URL protocol.

Short Description

Anchor elements must not have an href attribute value that starts with "javascript:".

How To Repair

Remove the Javascript URL protocol from the anchor element and replace it with a fallback HREF value and a Javascript event handler.

Steps To Check

Procedure

1. Check the HREF value of each a (anchor) element.

Expected Result

1. The HREF value must not start with "javascript:".

Failed Result

1. Remove the Javascript URL protocol from the anchor element and replace it with a fallback HREF value and a Javascript event handler.

Examples

Pass Examples

Anchor does not use the Javascript URL protocol.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html xml:lang="en-US" lang="en">
<head>
<title>OAC Testfile - Check #181 - Negative</title>
</head>
<body>
<a href="fallback.html" onclick="dosomething(); return false;">Scripted link with fallback</a>
</body>
</html>

Fail Examples

Anchor uses the Javascript URL protocol.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html xml:lang="en-US" lang="en">
<head>
<title>OAC Testfile - Check #181 - Positive</title>
</head>
<body>
<a href="javascript:dosomething()">Scripted link</a>
</body>
</html>

English | German | Italiano


Web site engine's code is copyright © 2011
Inclusive Design Institute
Web Service API