ESLint v8.x reached end-of-life on 2024-10-05 and is no longer maintained. Upgrade or consider long-term support options
Versions

no-script-url

Disallow javascript: urls

Using javascript: URLs is considered by some as a form of eval. Code passed in javascript: URLs has to be parsed and evaluated by the browser in the same way that eval is processed.

Rule Details

Examples of incorrect code for this rule:

Open in Playground
/*eslint no-script-url: "error"*/

location.href = "javascript:void(0)";

location.href = `javascript:void(0)`;

Compatibility

  • JSHint: This rule corresponds to scripturl rule of JSHint.

Version

This rule was introduced in ESLint v0.0.9.

Further Reading

Resources

Change Language