Exclude rel=dns-prefetch links (#1520)

Resolves #1499
This commit is contained in:
wackget 2024-10-12 00:37:54 +01:00 committed by GitHub
parent 18d486d782
commit e398325bb0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -76,10 +76,10 @@ impl TokenSink for LinkExtractor {
}
}
// Check and exclude rel=preconnect. Other than prefetch and preload,
// preconnect only does DNS lookups and might not be a link to a resource
// Check and exclude `rel=preconnect` and `rel=dns-prefetch`. Unlike `prefetch` and `preload`,
// `preconnect` and `dns-prefetch` only perform DNS lookups and do not necessarily link to a resource
if let Some(rel) = attrs.iter().find(|attr| &attr.name.local == "rel") {
if rel.value.contains("preconnect") {
if rel.value.contains("preconnect") || rel.value.contains("dns-prefetch") {
return TokenSinkResult::Continue;
}
}