Skip to content

Commit

Permalink
Define link processing for prefetch
Browse files Browse the repository at this point in the history
Prefetch is simply a fetch with `prefetch-src` CSP and no
post-processing of the resource.

Closes whatwg#5229
  • Loading branch information
noamr committed Jan 17, 2023
1 parent 1515288 commit 49b3a21
Showing 1 changed file with 35 additions and 5 deletions.
40 changes: 35 additions & 5 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -26048,15 +26048,45 @@ document.body.appendChild(wbr);</code></pre>
link</span>. This keyword is <span>body-ok</span>.</p>

<p>The <code data-x="rel-prefetch">prefetch</code> keyword indicates that preemptively <span
data-x="concept-fetch">fetching</span> and caching the specified resource is likely to be
beneficial, as it is highly likely that the user will require this resource for future
navigations. <span w-nodev>User agents must implement the processing model of the <code
data-x="rel-prefetch">prefetch</code> keyword described in <cite>Resource Hints</cite>.</span>
<ref spec=RESOURCEHINTS></p>
data-x="concept-fetch">fetching</span> and caching the specified resource or same-site document is
likely to be beneficial, as it is highly likely that the user will require this resource for
future navigations.</p>

<p>There is no default type for resources given by the <code data-x="rel-prefetch">prefetch</code>
keyword.</p>

<p>The <span>fetch and process the linked resource</span> algorithm for <code
data-x="rel-prefetch">prefetch</code> links, given a <code>link</code> element
<var>el</var>, is as follows:</p>

<ol>
<li><p>If <var>el</var>'s <code data-x="attr-link-href">href</code> attribute's value is the
empty string, then return.</p></li>

<li><p>Let <var>options</var> be the result of <span data-x="create link options from
element">creating link options</span> from <var>el</var>.</p></li>

<li><p>Let <var>request</var> be the result of <span data-x="create a link request">creating a
link request</span> given <var>options</var>.</p></li>

<li><p>Set <var>request</var>'s <span data-x="concept-request-destination">destination</span>
to "<code data-x="">prefetch</code>".</p></li>

<li><p>Set <var>request</var>'s <span data-x="concept-request-initiator">initiator</span>
to "<code data-x="">prefetch</code>".</p></li>

<li><p>Set <var>request</var>'s <span
data-x="concept-request-header-list">header list</span> to « (`<code
data-x="">Sec-Purpose</code>`, `<code data-x="">Prefetch</code>) ».</p></li>

<li><p>The user agent should <span data-x="concept-fetch">fetch</span> <var>request</var>. User
agents may delay the fetching of <var>request</var> to prioritize othere requests that are
necessary for the current document.</p></li>
</ol>

<p>The <span>process a link header</span> steps for this type of linked resource are to do
nothing.</p>


<h5>Link type "<dfn for="link/rel" attr-value><code
data-x="rel-preload">preload</code></dfn>"</h5>
Expand Down

0 comments on commit 49b3a21

Please sign in to comment.