-
Notifications
You must be signed in to change notification settings - Fork 23.2k
Add standard names for Device Client hints #42351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e5fcc78
Add standard names for Device Client hints
tunetheweb 9a5aed4
Restore status's removed in error
tunetheweb a6c6691
Correct header data
tunetheweb 6929244
Restore deprecated See also to old pages
tunetheweb 1891c06
Review feedback on new pages
tunetheweb 5934faf
Update files/en-us/web/http/reference/headers/device-memory/index.md
hamishwillee f55436a
Update files/en-us/web/http/reference/headers/sec-ch-viewport-height/…
hamishwillee 47ddac3
Update files/en-us/web/http/reference/headers/device-memory/index.md
hamishwillee 11b321d
Update files/en-us/web/http/reference/headers/device-memory/index.md
hamishwillee 4f864d2
Update files/en-us/web/http/reference/headers/viewport-width/index.md
hamishwillee 70004ef
Apply suggestions from code review
hamishwillee File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
files/en-us/web/http/reference/headers/sec-ch-device-memory/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| --- | ||
| title: Sec-CH-Device-Memory header | ||
| short-title: Sec-CH-Device-Memory | ||
| slug: Web/HTTP/Reference/Headers/Sec-CH-Device-Memory | ||
| page-type: http-header | ||
| browser-compat: http.headers.Sec-CH-Device-Memory | ||
| sidebar: http | ||
| --- | ||
|
|
||
| {{SecureContext_Header}} | ||
|
|
||
| The HTTP **`Sec-CH-Device-Memory`** {{Glossary("request header")}} is used in [device client hints](/en-US/docs/Web/HTTP/Guides/Client_hints#device_client_hints) to indicate the approximate amount of available RAM on the client device, in gigabytes. | ||
| The header is part of the {{DOMxRef("Device Memory API", "Device Memory API", "", "nocode")}}. | ||
|
|
||
| Client hints are accessible only on secure origins. | ||
| A server has to opt in to receive the `Sec-CH-Device-Memory` header from the client, by first sending the {{HTTPHeader("Accept-CH")}} response header. | ||
| Servers that opt in to the `Sec-CH-Device-Memory` client hint will typically also specify it in the {{HTTPHeader("Vary")}} header to inform caches that the server may send different responses based on the header value in a request. | ||
|
|
||
| <table class="properties"> | ||
| <tbody> | ||
| <tr> | ||
| <th scope="row">Header type</th> | ||
| <td> | ||
| {{Glossary("Request header")}}, | ||
| <a href="/en-US/docs/Web/HTTP/Guides/Client_hints">Client hint</a> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <th scope="row">{{Glossary("Forbidden request header")}}</th> | ||
| <td>No</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```http | ||
| Sec-CH-Device-Memory: <number> | ||
| ``` | ||
|
|
||
| ## Directives | ||
|
|
||
| - `<number>` | ||
| - : The approximate amount of device RAM. Possible values are: `0.25`, `0.5`, `1`, `2`, `4`, `8`. | ||
| The amount of device RAM can be used as a {{glossary("fingerprinting")}} variable, so values for the header are intentionally coarse to reduce the potential for its misuse. | ||
|
|
||
| ## Examples | ||
|
|
||
| The server first needs to opt in to receive `Sec-CH-Device-Memory` header by sending the {{HTTPHeader("Accept-CH")}} response header containing `Sec-CH-Device-Memory`: | ||
|
|
||
| ```http | ||
| Accept-CH: Sec-CH-Device-Memory | ||
| ``` | ||
|
|
||
| Then on subsequent requests the client might send `Sec-CH-Device-Memory` header back: | ||
|
|
||
| ```http | ||
| Sec-CH-Device-Memory: 1 | ||
| ``` | ||
|
|
||
| ## Specifications | ||
|
|
||
| {{Specifications}} | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - [Improving user privacy and developer experience with User-Agent Client Hints](https://developer.chrome.com/docs/privacy-security/user-agent-client-hints) (developer.chrome.com) | ||
| - {{DOMxRef("Device Memory API", "Device Memory API", "", "nocode")}} | ||
| - {{DOMxRef("Navigator.deviceMemory")}} | ||
| - {{DOMxRef("WorkerNavigator.deviceMemory")}} | ||
| - Device client hints | ||
| - {{HTTPHeader("Sec-CH-DPR")}} | ||
| - {{HTTPHeader("Sec-CH-Viewport-Height")}} | ||
| - {{HTTPHeader("Sec-CH-Viewport-Width")}} | ||
|
tunetheweb marked this conversation as resolved.
|
||
| - {{HTTPHeader("Device-Memory")}} {{deprecated_inline}} | ||
| - {{HTTPHeader("Accept-CH")}} | ||
| - [HTTP Caching: Vary](/en-US/docs/Web/HTTP/Guides/Caching#vary) and {{HTTPHeader("Vary")}} | ||
76 changes: 76 additions & 0 deletions
76
files/en-us/web/http/reference/headers/sec-ch-dpr/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| --- | ||
| title: Sec-CH-DPR header | ||
| short-title: Sec-CH-DPR | ||
| slug: Web/HTTP/Reference/Headers/Sec-CH-DPR | ||
| page-type: http-header | ||
| browser-compat: http.headers.Sec-CH-DPR | ||
| sidebar: http | ||
| --- | ||
|
|
||
| {{SecureContext_Header}} | ||
|
|
||
| The HTTP **`Sec-CH-DPR`** {{Glossary("request header")}} provides [device client hints](/en-US/docs/Web/HTTP/Guides/Client_hints) about the client device pixel ratio (DPR). | ||
| This ratio is the number of physical device pixels corresponding to every {{Glossary("CSS pixel")}}. | ||
|
|
||
| The hint is useful when selecting image sources that best correspond to a screen's pixel density. | ||
| This is similar to the role played by `x` descriptors in the `<img>` [`srcset`](/en-US/docs/Web/HTML/Reference/Elements/img#srcset) attribute to allow user agents to select a preferred image. | ||
|
|
||
| If the `Sec-CH-DPR` header appears more than once in a message the last occurrence is used. | ||
|
|
||
| Servers that opt in to the `Sec-CH-DPR` client hint will typically also specify it in the {{HTTPHeader("Vary")}} header to inform caches that the server may send different responses based on the header value in a request. | ||
|
|
||
| <table class="properties"> | ||
| <tbody> | ||
| <tr> | ||
| <th scope="row">Header type</th> | ||
| <td> | ||
| {{Glossary("Request header")}}, | ||
| <a href="/en-US/docs/Web/HTTP/Guides/Client_hints">Client hint</a> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <th scope="row">{{Glossary("Forbidden request header")}}</th> | ||
| <td>No</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```http | ||
| Sec-CH-DPR: <number> | ||
| ``` | ||
|
|
||
| ## Directives | ||
|
|
||
| - `<number>` | ||
| - : The client device pixel ratio. | ||
|
|
||
| ## Examples | ||
|
|
||
| A server must first opt in to receive the `Sec-CH-DPR` header by sending the response header {{HTTPHeader("Accept-CH")}} containing the directive `Sec-CH-DPR`. | ||
|
|
||
| ```http | ||
| Accept-CH: Sec-CH-DPR | ||
| ``` | ||
|
|
||
| Then on subsequent requests the client might send `Sec-CH-DPR` header to the server: | ||
|
|
||
| ```http | ||
| Sec-CH-DPR: 2.0 | ||
| ``` | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - Device client hints | ||
| - {{HTTPHeader("Sec-CH-Device-Memory")}} | ||
| - {{HTTPHeader("Sec-CH-Viewport-Height")}} | ||
| - {{HTTPHeader("Sec-CH-Viewport-Width")}} | ||
|
tunetheweb marked this conversation as resolved.
|
||
| - {{HTTPHeader("DPR")}} {{deprecated_inline}} | ||
| - {{HTTPHeader("Accept-CH")}} | ||
| - [HTTP Caching: Vary](/en-US/docs/Web/HTTP/Guides/Caching#vary) and {{HTTPHeader("Vary")}} | ||
| - [Improving user privacy and developer experience with User-Agent Client Hints](https://developer.chrome.com/docs/privacy-security/user-agent-client-hints) (developer.chrome.com) | ||
76 changes: 76 additions & 0 deletions
76
files/en-us/web/http/reference/headers/sec-ch-viewport-height/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| --- | ||
| title: Sec-CH-Viewport-Height header | ||
| short-title: Sec-CH-Viewport-Height | ||
| slug: Web/HTTP/Reference/Headers/Sec-CH-Viewport-Height | ||
| page-type: http-header | ||
| browser-compat: http.headers.Sec-CH-Viewport-Height | ||
| sidebar: http | ||
| --- | ||
|
|
||
| {{SecureContext_header}} | ||
|
|
||
| The HTTP **`Sec-CH-Viewport-Height`** {{Glossary("request header")}} is a [device client hint](/en-US/docs/Web/HTTP/Guides/Client_hints) which provides the client's layout viewport height in {{Glossary("CSS pixel", "CSS pixels")}}. | ||
| The value is rounded up to the smallest following integer (i.e., ceiling value). | ||
|
|
||
| The hint can be used with other screen-specific hints to deliver images optimized for a specific screen size, or to omit resources that are not needed for a particular screen height. | ||
| If the `Sec-CH-Viewport-Height` header appears more than once in a message the last occurrence is used. | ||
|
|
||
| A server has to opt-in to receive the `Sec-CH-Viewport-Height` header from the client, by sending the {{HTTPHeader("Accept-CH")}} response header. | ||
| Servers that opt-in will typically also specify it in the {{HTTPHeader("Vary")}} header which informs caches that the server may send different responses based on the header value in a request. | ||
|
|
||
| <table class="properties"> | ||
| <tbody> | ||
| <tr> | ||
| <th scope="row">Header type</th> | ||
| <td> | ||
| {{Glossary("Request header")}}, | ||
| <a href="/en-US/docs/Web/HTTP/Guides/Client_hints">Client hint</a> | ||
| </td> | ||
| </tr> | ||
| <tr> | ||
| <th scope="row">{{Glossary("Forbidden request header")}}</th> | ||
| <td>No</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
|
|
||
| ## Syntax | ||
|
|
||
| ```http | ||
| Sec-CH-Viewport-Height: <number> | ||
| ``` | ||
|
|
||
| ## Directives | ||
|
|
||
| - `<number>` | ||
| - : The height of the user's viewport in {{Glossary("CSS pixel","CSS pixels")}}, rounded up to the nearest integer. | ||
|
|
||
| ## Examples | ||
|
|
||
| ### Using Sec-CH-Viewport-Height | ||
|
|
||
| A server must first opt-in to receive the `Sec-CH-Viewport-Height` header by sending the response header {{HTTPHeader("Accept-CH")}} containing the directive `Sec-CH-Viewport-Height`. | ||
|
|
||
| ```http | ||
| Accept-CH: Sec-CH-Viewport-Height | ||
| ``` | ||
|
|
||
| In subsequent requests, the client might send `Sec-CH-Viewport-Height` header: | ||
|
|
||
| ```http | ||
| Sec-CH-Viewport-Height: 480 | ||
| ``` | ||
|
|
||
| ## Browser compatibility | ||
|
|
||
| {{Compat}} | ||
|
|
||
| ## See also | ||
|
|
||
| - [Improving user privacy and developer experience with User-Agent Client Hints](https://developer.chrome.com/docs/privacy-security/user-agent-client-hints) (developer.chrome.com) | ||
| - Device client hints | ||
| - {{HTTPHeader("Sec-CH-Device-Memory")}} | ||
| - {{HTTPHeader("Sec-CH-DPR")}} | ||
| - {{HTTPHeader("Sec-CH-Viewport-Width")}} | ||
| - {{HTTPHeader("Accept-CH")}} | ||
| - [HTTP Caching: Vary](/en-US/docs/Web/HTTP/Guides/Caching#vary) and {{HTTPHeader("Vary")}} header |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.