w3c / link-checker

Check links and anchors in Web pages or full Web sites.
https://validator.w3.org/checklink
121 stars 38 forks source link

Don't check <link rel="preconnect"> and <link rel="dns-prefetch"> #50

Closed PikeUK closed 3 years ago

PikeUK commented 3 years ago

The two \<link> types "preconnect" and "dns-prefetch" do not link to an actual resource but tell the browser to set up a connection with that site. They usually specify just the scheme and host (without a path) in the href.

Actual behaviour

Link checker tries to access the root of the domain and returns an error if there is nothing there (as there often won't be for sites that just host resources, the main target of preconnect).

Expected behaviour

Ignore \<link> elements with rel="preconnect" or rel="dns-prefetch" since they are specifying a site rather than a specific resource.

Example

The following site demonstrates this problem (unfortunately it's not an ideal testcase as it has so many links to check):

https://www.smashingmagazine.com/