Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<link rel="shortcut icon"> validation error despite being valid

The w3.org validator is giving me an error on the following line:

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />

This is the full error it gives:

Line 1, Column 727: Bad value shortcut icon for attribute rel on element link: The string shortcut is not a registered keyword. The string shortcut is not an absolute URL.

…f="/favicon.ico" type="image/x-icon" />

Syntax of link type valid for :

A whitespace-separated list of link types listed as allowed on in the HTML specification or listed as an allowed on on the Microformats wiki without duplicate keywords in the list.

You can register link types on the Microformats wiki yourself.

Syntax of absolute IRI: An absolute URL.

For example: http://example.org/hello, but not /hello. Spaces should be escaped as %20.

What I don't understand is that I'm following the HTML5 spec which says:

For historical reasons, the icon keyword may be preceded by the keyword "shortcut". If the "shortcut" keyword is present, it must be come immediately before the icon keyword and the two keywords must be separated by only a single U+0020 SPACE character.

I see that it is suggesting the %20 as a space, which I've tried:

<link rel="shortcut%20icon" href="/favicon.ico" type="image/x-icon" />

But when I use this code, the error I get is nearly the same, except it starts out:

Error Line 1, Column 729: Bad value shortcut%20icon for attribute rel on element link: The string shortcut%20icon is not a registered keyword. The string shortcut%20icon is not an absolute URL.

like image 482
brentonstrine Avatar asked Feb 09 '26 17:02

brentonstrine


2 Answers

Seems to be an issue with the W3C validator. All my HTML5 projects – they were valid last week – throw the same error as mentioned today. Using an alternative validator (e.g. the Validator.nu (X)HTML5 Validator) everything is fine.

like image 72
digitalbricks Avatar answered Feb 14 '26 09:02

digitalbricks


I received this message today from Steve Faulkner.

It was due to a bug in the validator, its has been fixed and will be pushed tomorrow.

Steve Faulkner

TPG Distinguished Accessibility Engineer

-

Co-editor HTML 5.1

like image 29
Neil Ormsby Avatar answered Feb 14 '26 10:02

Neil Ormsby