-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Scenario:
The document root / of an origin needs access to Client Hints, and the only option is to use <meta> tags like <meta http-equiv="delegate-ch" content=""> and/or <meta http-equiv="accept-ch" content="">.
The problem is that these two <meta> tags, in any combination, will not make the client hints available to the document opting in (/), but only to subsequent requests initiated by that document.
Issues:
<meta http-equiv="accept-ch">is semantically incorrect because opting-in using the meta tag does not have the same behaviour as the accept-ch HTTP header. Opting in using HTTP headers, will make client hints available on the next navigation (reload) to the document root/.<meta http-equiv="delegate-ch" content="">alone will delegate the desired hints to the specified parties, including the origin (!), even without explicit opt-in using<meta http-equiv="accept-ch" content="">. This might be intended by design, but what is then the purpose of<meta http-equiv="accept-ch" content="">?- It is reasonable to expect that
<meta http-equiv="accept-ch" content="">will add hints to the Accept-CH cache, which it don't.
Here's a glitch demoing the scenarios.
Proposed solution:
Because the content of http-equiv="delegate-ch" should be parsed like a policy directive it is reasonable to suggest that <meta http-equiv="delegate-ch" content=""> would be able to delegate access to the hints using 'self' so that the document root / can interact with the client hints: <meta http-equiv="delegate-ch" content="dpr 'self'">
It may also reasonable to require an explicit opt-in in addition to the delegation using <meta http-equiv="accept-ch" content="">, but to be semantically correct and offer the expected behaviour, the hints should be added to the Accept-CH cache.
Delegating to 'self' should probably have no effect if the origin didn't opt-in with http-equiv="accept-ch" first.
Related issue: 108