Skip to content

noScriptUrl

biome.json
{
"linter": {
"rules": {
"nursery": {
"noScriptUrl": "error"
}
}
}
}

Disallow javascript: URLs in HTML.

Using javascript: URLs is considered a form of eval and can be a security risk. These URLs can execute arbitrary JavaScript code, which can lead to cross-site scripting (XSS) vulnerabilities.

<a href="javascript:void(0)">Click me</a>
code-block.html:1:8 lint/nursery/noScriptUrl ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Avoid using javascript: URLs, as they can be a security risk.

> 1 │ <a href=“javascript:void(0)“>Click me</a>
^^^^^^^^^^^^^^^^^^^^^
2 │

Using javascript: URLs can lead to security vulnerabilities such as cross-site scripting (XSS).

Consider using regular URLs, or if you need to handle click events, use event handlers instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<a href="javascript:alert('XSS')">Click me</a>
code-block.html:1:8 lint/nursery/noScriptUrl ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Avoid using javascript: URLs, as they can be a security risk.

> 1 │ <a href=“javascript:alert(‘XSS’)“>Click me</a>
^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

Using javascript: URLs can lead to security vulnerabilities such as cross-site scripting (XSS).

Consider using regular URLs, or if you need to handle click events, use event handlers instead.

This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.

<a href="https://example.com">Click me</a>
<a href="/path/to/page">Click me</a>
<a href="#section">Click me</a>
<span href="javascript:void(0)">Not a real href</span>