blob: e55e248829f1eec6700cf804c65a3cd18837e6f0 [file] [log] [blame] [view]
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:561# 103 Early Hints
2
Kenichi Ishibashi392a7602023-02-16 03:09:453Contact: net-dev@chromium.org
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:564
Kenichi Ishibashi392a7602023-02-16 03:09:455As of version 103, Chrome supports
Kenichi Ishibashi7e394ecd2021-08-24 07:28:246[Early Hints](https://datatracker.ietf.org/doc/html/rfc8297).
Kenichi Ishibashi6d43eb852022-04-20 02:28:547Early Hints enable browsers to preload subresources or preconnect to servers
8before the main response is served. See the
9[explainer](https://github.com/bashi/early-hints-explainer/blob/main/explainer.md)
10how it works.
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5611
Kenichi Ishibashi7e394ecd2021-08-24 07:28:2412## What’s supported
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5613
Kenichi Ishibashicdbd1ec9e2021-09-03 00:24:4714Chrome supports [preload](https://w3c.github.io/preload/) and
15[preconnect](https://w3c.github.io/resource-hints/#dfn-preconnect) in
Kenichi Ishibashi6d43eb852022-04-20 02:28:5416Early Hints for top-level frame navigation.
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5617
Kenichi Ishibashi7e394ecd2021-08-24 07:28:2418## What’s not supported
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5619
Kenichi Ishibashi6d43eb852022-04-20 02:28:5420To reduce security and privacy implications, the HTML and Fetch living standards
21have some restrictions on when Early Hints can be handled. Chrome ignores Early
22Hints sent in the following situations to comply these specifications.
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5623
Kenichi Ishibashi7e394ecd2021-08-24 07:28:2424* Early Hints sent on subresource requests
25* Early Hints sent on iframe navigation
26* Early Hints sent on HTTP/1.1 or earlier
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5627
Kenichi Ishibashi6d43eb852022-04-20 02:28:5428Chrome ignores the second and following Early Hints responses. Chrome only
29handles the first Early Hints response so that Chrome doesn't apply inconsistent
30security policies (e.g. Content-Security-Policy).
31
Kenichi Ishibashicdbd1ec9e2021-09-03 00:24:4732Chrome doesn’t handle
33[dns-prefetch](https://w3c.github.io/resource-hints/#dfn-dns-prefetch) and
34[prefetch](https://w3c.github.io/resource-hints/#dfn-prefetch) in Early Hints
35yet. We consider supporting them in the future.
Hiroki Nakagawa0c9ee9f92020-10-16 02:46:5636
Kenichi Ishibashi392a7602023-02-16 03:09:4537## Checking Early Hints preload is working
Kenichi Ishibashi7e394ecd2021-08-24 07:28:2438
39If a resource is preloaded by Early Hints, the corresponding
40[PerformanceResourceTiming](https://w3c.github.io/resource-timing/#sec-performanceresourcetiming)
41object reports `initiatorType` is "early-hints".
42```
Eric Lawrence [MSFT]694be822021-09-03 23:34:2243performance.getEntriesByName('https://a.test/style.css')[0].initiatorType
Kenichi Ishibashi7e394ecd2021-08-24 07:28:2444// => 'early-hints'
45```
46
Kenichi Ishibashi539af452023-05-19 07:09:2447### Reliability of `initiatorType`
Kenichi Ishibashi392a7602023-02-16 03:09:4548
Kenichi Ishibashi539af452023-05-19 07:09:2449Due to an implementation limitation, `initiatorType` may not always set to
50"early-hints". See
51[the proposal](https://docs.google.com/document/d/1V7xX2cRNxcsuIrtZk4srdZuqXynnYlPG9fFDnELXC_Y/edit?usp=sharing)
52for more details.