@@ -14341,21 +14341,68 @@ interface <dfn interface>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
14341
14341
<li><p>Return <var>links</var>.</p></li>
14342
14342
</ol>
14343
14343
14344
- <h6>Early Hint Headers </h6>
14344
+ <h6>Early Hints </h6>
14345
14345
14346
- <p>Early hint headers allow user-agents to perform some operations, such as speculative loading
14347
- resources that are likely to be used by the document, before the navigation request is fully
14346
+ <p><dfn> Early hints</dfn> allow user-agents to perform some operations, such as to speculatively
14347
+ load resources that are likely to be used by the document, before the navigation request is fully
14348
14348
handled by the server and a response code is served. Servers can indicate early hints by serving a
14349
14349
<span data-x="concept-response">response</span> with a 103 status code before serving the final
14350
14350
<span data-x="concept-response">response</span>.<ref spec=RFC8297></p>
14351
14351
14352
+ <div class="example">
14353
+ <p>For example, given the following sequence of responses:</p>
14354
+ <pre>
14355
+ 103 Early Hint
14356
+ Link: </image.png>; rel=preload; as=image
14357
+ </pre>
14358
+
14359
+ <pre>
14360
+ 200 OK
14361
+ Content-Type: text/html
14362
+
14363
+ <!DOCTYPE html>
14364
+ ...
14365
+ <img src="/image.png">
14366
+ </pre>
14367
+
14368
+ <p>the image will start loading before the HTML content arrives.</p>
14369
+ </div>
14370
+
14352
14371
<p class="note">Only the first early hint response served during the navigation is handled, and it
14353
- is discarded if it is succeeded by a cross-origin redirect. In addition to the early hint, the 103
14354
- response may also contain a <span>Content Security Policy</span> header, which is enforced when
14355
- processing the early hints.</p>
14372
+ is discarded if it is succeeded by a cross-origin redirect. In addition to the early hint, it is
14373
+ possbile that the 103 response contains a <span>Content Security Policy</span> header, which is
14374
+ enforced when processing the early hints.</p>
14375
+
14376
+ <div class="example">
14377
+ <p>For example, given the following sequence of responses:</p>
14378
+ <pre>
14379
+ 103 Early Hint
14380
+ Content-Security-Policy: style-src: self;
14381
+ Link: </style.css>; rel=preload; as=style
14382
+ </pre>
14383
+
14384
+ <pre>
14385
+ 103 Early Hint
14386
+ Link: </image.png>; rel=preload; as=image
14387
+ </pre>
14388
+
14389
+ <pre>
14390
+ 302 Redirect
14391
+ Location: /alternate.html
14392
+ </pre>
14393
+
14394
+ <pre>
14395
+ 200 OK
14396
+ Content-Security-Policy: style-src: none;
14397
+ Link: </font.ttf>; rel=prelad; as=font
14398
+ </pre>
14399
+
14400
+ <p>The font and style would be loaded, and the image will be discarded, as only the first early hint
14401
+ response in the final redirect chain is respected. The late <span>Content Security Policy</span>
14402
+ header comes after the request to fetch the style has already been performed, but the style will
14403
+ not be accessible to the document.</p>
14404
+ </div>
14356
14405
14357
- <p class="example">
14358
- </p>
14359
14406
14360
14407
<p>To <dfn>process early hint headers</dfn> given a
14361
14408
<span data-x="concept-response">response</span> <var>response</var> and an
@@ -88787,7 +88834,7 @@ interface <dfn interface>Location</dfn> { // but see also <a href="#the-location
88787
88834
<li>
88788
88835
<p>Set <var>uncommittedPreloads</var> to null.</p>
88789
88836
88790
- <p class="note">Preloaded links from <span data-x="process early hint headers ">early hint
88837
+ <p class="note">Preloaded links from <span data-x="early hints ">early hint
88791
88838
headers</span> remain in the preload cache after a <span>same origin</span> redirect, but
88792
88839
get discarded when the redirect is cross-origin.</p>
88793
88840
</li>
@@ -127445,6 +127492,9 @@ INSERT INTERFACES HERE
127445
127492
<dt id="refsRFC7578">[RFC7578]</dt>
127446
127493
<dd><cite><a href="https://tools.ietf.org/html/rfc7578">Returning Values from Forms: multipart/form-data</a></cite>, L. Masinter. IETF.</dd>
127447
127494
127495
+ <dt id="refsRFC8297">[RFC8297]</dt>
127496
+ <dd><cite><a href="https://tools.ietf.org/html/rfc8297">An HTTP Status Code for Indicating Hints</a></cite>, K. Oku. IETF.</dd>
127497
+
127448
127498
<dt id="refsSCREENORIENTATION">[SCREENORIENTATION]</dt>
127449
127499
<dd><cite><a href="https://w3c.github.io/screen-orientation/">Screen Orientation API</a></cite>, M. Lamouri, M. Cáceres. W3C.</dd>
127450
127500
0 commit comments