Have you ever wanted to let the browser know about an important font, script, or
other resource that will be needed by the page, without delaying the page's
<link rel="preload"> gives web developers to power to do just
that, using a familiar HTML element syntax with a few key attributes to
determine the exact behavior. It’s a
draft standard that’s shipping as part of the
Chrome 50 release.
Resources loaded via
<link rel="preload"> are stored locally in the browser,
CSS. For example, here’s one potential use case in which a script file is
preloaded, but not executed immediately, as it would have been if it were
included via a
<script> tag in the DOM.
So what's happening here? The
href attribute used in that example should
be familiar to web developers, as it’s the standard attribute used to specify
the URL of any linked resource.
as attribute is
probably new to you, however, and it’s used in the context of a
to give the browser more context about the
preloading request being made. This additional information ensures that the
browser will set appropriate request headers, request priority, as well as apply
any relevant Content Security Policy
directives that might be in place for the correct resource context.
Learn (a lot) more
Yoav Weiss wrote
the definitive guide
<link rel="preload">. If you’re intrigued and want to start using it
on your own pages, I’d recommend reading through his article to learn more about
the benefits and creative use cases.
<link rel="preload"> supersedes
<link rel="subresource">, which has
significant bugs and drawbacks, and
which was never implemented in browsers other than Chrome. As such, Chrome 50
removes support for