Skip to content

eslint/no-script-url Style

What it does

Disallow javascript: urls

Why is this bad?

Using javascript: URLs is considered by some as a form of eval. Code passed in javascript: URLs must be parsed and evaluated by the browser in the same way that eval is processed. This can lead to security and performance issues.

Examples

Examples of incorrect code for this rule

javascript
/*eslint no-script-url: "error"*/

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

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

References

Released under the MIT License.