AcceptCHCache Class
The Accept-CH cache of the user agent (https://wicg.github.io/client-hints-infrastructure/#accept-ch-cache): the client hints that each origin opted into with the Accept-CH header of the response of a top-level navigation, which are sent with the next requests to the origin (see BrowsingContextOptions.AcceptCHCache).
public sealed class AcceptCHCacheRemarks
The cache is keyed by the serialization of the origins (e.g. https://example.com), and its values are client hints tokens: the names of the request headers in lowercase (e.g. sec-ch-ua-arch). The names that are not client hints tokens are ignored. An origin that opted out (an empty Accept-CH header) has an empty entry.
The cache acts as a cookie store (a site can use the hints as bits of an identifier): clear it when the cookies are cleared. It is kept in memory: to persist it, save its entries (AcceptCHCache.GetOrigins and AcceptCHCache.GetClientHints) and restore them with AcceptCHCache.SetClientHints. The cache is thread-safe: it can be shared by several browsing contexts.
Constructors
| Name | Description |
|---|---|
| AcceptCHCache() |
AcceptCHCache()
AcceptCHCache.cspublic AcceptCHCache()No documentation is available.
Methods
| Name | Description |
|---|---|
| Clear() | Removes all the entries. |
| GetClientHints(string) | Returns the client hints tokens of an origin (e.g. sec-ch-ua-arch): empty when the origin has no entry. |
| GetOrigins() | Returns the serialized origins that have an entry in the cache. |
| Remove(string) | Removes the entry of an origin, as the Clear-Site-Data header does. Returns whether the origin had an entry. |
| SetClientHints(string, IEnumerable<string>) | Creates or overrides the entry of an origin. |
Clear()
AcceptCHCache.csRemoves all the entries.
public void Clear()GetClientHints(string)
AcceptCHCache.csReturns the client hints tokens of an origin (e.g. sec-ch-ua-arch): empty when the origin has no entry.
public IReadOnlyList<string> GetClientHints(string origin)GetOrigins()
AcceptCHCache.csReturns the serialized origins that have an entry in the cache.
public IReadOnlyList<string> GetOrigins()Returns
Remove(string)
AcceptCHCache.csSetClientHints(string, IEnumerable<string>)
AcceptCHCache.csCreates or overrides the entry of an origin.
public void SetClientHints(string origin, IEnumerable<string> clientHints)Parameters
originstring- The serialization of the origin (e.g.
https://example.com). clientHintsIEnumerable<string>- The client hints tokens (ASCII case-insensitive); the other names are ignored.