link rel="shortcut icon"
shortcut is not a link relation; browsers already parse rel="shortcut icon" as icon, so the token is inert.
- Avoid
- Unnecessary
- Severity
- UnnecessaryWorks, but is dead weight.
- Basis
- SpecifiedThe evidence is in a current standard.
- Detectable
- YesMatched exactly. Autofixable when the rule carries a fix.
- Matches
link[rel~="shortcut" i]Element rule, inside <head>.- Fix
- Removes the keyword shortcut from rel
- Impacts
- Maintainability
- Related
meta/http-equiv-x-ua-compatible
rel="shortcut icon" is the spelling Internet Explorer 5 introduced for the “favorites
icon” in 1999, before there was a specification for any of it. Every boilerplate of the
following decade copied it, and it is still being copied today — usually alongside a
second <link rel="icon"> that does the same job.
Why avoid
shortcut is not a link relation. The HTML Standard defines icon and registers the
keywords a rel may contain; shortcut is not among them. The rel attribute is a
space-separated set of tokens, so a browser parsing shortcut icon finds two tokens,
recognises icon, does not recognise shortcut, and discards it. The markup that runs
is rel="icon" either way.
That makes the token worse than merely redundant: it is a decision a reader has to make
and cannot resolve from the markup. The usual guess is that shortcut is there for old
browsers, which is backwards — Internet Explorer accepted plain rel="icon" too, and no
browser has ever needed the longer form. So it survives on inertia, and every copy
teaches the next author that it is required.
Use instead
Delete the token. Nothing else about the element changes:
<link rel="icon" href="/favicon.ico" sizes="32x32">
<link rel="icon" href="/icon.svg" type="image/svg+xml">
Detectability
Fully detectable. ~= matches one whitespace-separated token, which is exactly how a
browser parses rel, so the selector agrees with the parser rather than approximating
it. The i flag is load-bearing: link types are ASCII case-insensitive and older
boilerplate is full of rel="Shortcut Icon".
The fix removes the single token rather than asserting a new value for rel, so a
rel="shortcut icon mask-icon" keeps its mask-icon, and the quoting is left exactly
as written — the edit happens inside the delimiter. If shortcut is somehow the only
token, no fix is offered: emptying rel would say something different from what the
author wrote, and that is a decision for a person.
Resources
- HTML Standard —
rel="icon"— the keyword the specification actually defines, and its processing. - HTML Standard — link types — the registry of permitted
relkeywords, whichshortcutis absent from. - Mathias Bynens —
rel="shortcut icon"considered harmful — the primary write-up of where the spelling came from and why it is unnecessary.
This page is generated from content/rules/link/shortcut-icon.md, the same file the linter is built from. Think the rule is wrong, or that browsers moved on? Say so — that is the most useful issue you can file.