Update early hints document
Now it's enabled by default. Remove text related to activation. Bug: N/A Change-Id: I65d1abb13f7e635bb287991cb7f2a925737c288e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4258666 Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Reviewed-by: Adam Rice <ricea@chromium.org> Cr-Commit-Position: refs/heads/main@{#1106042}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4f801d0b3b
commit
392a760d97
@ -1,19 +1,14 @@
|
||||
# 103 Early Hints
|
||||
|
||||
Contact: early-hints-experiment@chromium.org
|
||||
Contact: net-dev@chromium.org
|
||||
|
||||
As of version 95, Chrome experimentally supports
|
||||
As of version 103, Chrome supports
|
||||
[Early Hints](https://datatracker.ietf.org/doc/html/rfc8297).
|
||||
Early Hints enable browsers to preload subresources or preconnect to servers
|
||||
before the main response is served. See the
|
||||
[explainer](https://github.com/bashi/early-hints-explainer/blob/main/explainer.md)
|
||||
how it works.
|
||||
|
||||
Currently Chrome is running A/B testing in the field to evaluate the performance
|
||||
impact of Early Hints. Chrome also provides some ways to opt-in Early Hints for
|
||||
web developers who want to try the feature. This document describes the status
|
||||
of the current implementation and how to enable Early Hints support.
|
||||
|
||||
## What’s supported
|
||||
|
||||
Chrome supports [preload](https://w3c.github.io/preload/) and
|
||||
@ -39,48 +34,7 @@ Chrome doesn’t handle
|
||||
[prefetch](https://w3c.github.io/resource-hints/#dfn-prefetch) in Early Hints
|
||||
yet. We consider supporting them in the future.
|
||||
|
||||
## Activation
|
||||
|
||||
Early Hints can be enabled by a command line flag, or via
|
||||
[Origin Trial](https://developer.chrome.com/blog/origin-trials/).
|
||||
|
||||
### Using command line flag
|
||||
|
||||
Passing the `--enable-features=EarlyHintsPreloadForNavigation` command line flag
|
||||
to Chrome enables Early Hints support.
|
||||
|
||||
### Using Origin Trial
|
||||
|
||||
**Note**: As of version 98 the origin trial has expired. The Chrome networking
|
||||
team is preparing to ship the feature and the origin trial may be available
|
||||
again in the near future until it's fully shipped.
|
||||
|
||||
You can opt any page on your origin into Early Hints by
|
||||
[requesting a token for your origin](https://developer.chrome.com/origintrials/#/view_trial/2856408063659737089).
|
||||
Include the token in both Early Hints and the final response so that Chrome can
|
||||
recognize your pages opted in Early Hints.
|
||||
|
||||
```
|
||||
HTTP/1.1 103 Early Hints
|
||||
Origin-Trial: **your token**
|
||||
Link: </style.css>; rel="preload"; as="style"
|
||||
Link: <https://cdn.test>; rel="preconnect"
|
||||
|
||||
HTTP/1.1 200 OK
|
||||
Origin-Trial: **your token**
|
||||
Link: </style.css>; rel="preload"; as="style"
|
||||
Link: <https://cdn.test>; rel="preconnect"
|
||||
Content-Type: text/html; charset=utf-8
|
||||
|
||||
<!DOCTYPE html>
|
||||
...
|
||||
```
|
||||
|
||||
`<meta http-equiv="origin-trial" content="**your token**">` also works for the
|
||||
final response but doesn’t work for Early Hints since Early Hints cannot convey
|
||||
a response body.
|
||||
|
||||
### Checking Early Hints preload is working
|
||||
## Checking Early Hints preload is working
|
||||
|
||||
If a resource is preloaded by Early Hints, the corresponding
|
||||
[PerformanceResourceTiming](https://w3c.github.io/resource-timing/#sec-performanceresourcetiming)
|
||||
@ -90,6 +44,9 @@ performance.getEntriesByName('https://a.test/style.css')[0].initiatorType
|
||||
// => 'early-hints'
|
||||
```
|
||||
|
||||
Caveat: `initiatorType` may not always set to "early-hints" due to an
|
||||
implementation limitation. We would like to fix the issue in the future.
|
||||
|
||||
## Resources
|
||||
|
||||
* [Fastly's test page](https://early-hints.fastlylabs.com/)
|
||||
|
Reference in New Issue
Block a user