Skip to content

Commit

Permalink
[WebLink] Minor reword
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Dec 26, 2024
1 parent b3ed2cb commit 476bb59
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions web_link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ Imagine that your application includes a web page like this:
</body>
</html>

Following the traditional HTTP workflow, when this page is served browsers will
make one request for the HTML page and another request for the linked CSS file.
However, thanks to HTTP/2 your application can start sending the CSS file
contents even before browsers request them.

You can update the template to use the ``preload()`` Twig function provided by
WebLink. The `"as" attribute`_ is mandatory because browsers need it to apply
correct prioritization and the content security policy:
In a traditional HTTP workflow, when this page is loaded, browsers make one
request for the HTML document and another for the linked CSS file. However,
with HTTP/2, your application can send the CSS file's contents to the browser
before it requests them.

To achieve this, update your template to use the ``preload()`` Twig function
provided by WebLink. Note that the `"as" attribute`_ is required, as browsers use
it to prioritize resources correctly and comply with the content security policy:

.. code-block:: html+twig

Expand Down

0 comments on commit 476bb59

Please sign in to comment.