Skip to content

no-target-blank

Reports a link to another site with target="_blank" that does not have both noopener and noreferrer in its rel. A link to a scheme or host and a computed link ({href}, bind:href, :href) count; a relative link does not.

The opened page can reach this one through window.opener in old browsers and change its location (a phishing page), and it gets the referrer of the page it came from.

To fix, add rel="noopener noreferrer".

Reported
...
<template v-for="x in xs" :key="x"><li /></template>
...
<a :href="u" target="_blank">x</a>
</div>
</template>
angular:
lint:
rules:
no-target-blank: warn # off (default), warn, error
html:
lint:
rules:
no-target-blank: warn # off (default), warn, error
svelte:
lint:
rules:
no-target-blank: warn # off (default), warn, error
vue:
lint:
rules:
no-target-blank: warn # off (default), warn, error

Suppress one line with sudsy-disable-next-line no-target-blank in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
eslint-plugin-svelte no-target-blank full
eslint-plugin-vue no-template-target-blank full
html-eslint no-target-blank partial requires noopener as well as noreferrer (eslint-plugin-vue and -svelte do), html-eslint only noreferrer