]> git.proxmox.com Git - pve-eslint.git/blame - eslint/docs/src/rules/no-script-url.md
import 8.41.0 source
[pve-eslint.git] / eslint / docs / src / rules / no-script-url.md
CommitLineData
8f9d1d4d
DC
1---
2title: no-script-url
8f9d1d4d
DC
3rule_type: suggestion
4further_reading:
5- https://stackoverflow.com/questions/13497971/what-is-the-matter-with-script-targeted-urls
6---
7
eb39fafa
DC
8
9Using `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.
10
11## Rule Details
12
13Examples of **incorrect** code for this rule:
14
8f9d1d4d
DC
15::: incorrect
16
eb39fafa
DC
17```js
18/*eslint no-script-url: "error"*/
19
20location.href = "javascript:void(0)";
6f036462
TL
21
22location.href = `javascript:void(0)`;
eb39fafa
DC
23```
24
8f9d1d4d
DC
25:::
26
eb39fafa
DC
27## Compatibility
28
29* **JSHint**: This rule corresponds to `scripturl` rule of JSHint.