How to Load Resources With Priority in HTML

How to Load Resources With Priority in HTML

Ferenc Almasi β€’ 2020 September 18 β€’ Read time 1 min read
  • twitter
  • facebook
HTML

With the preload attribute in HTML, you can implement different loading strategies for high priority resources.

Copied to clipboard!
<!-- Load resources with priority using preload -->

<link rel="preload" href="style.css" as="style" />
<link rel="preload" href="app.js" as="script" />
download.html

This will ensure that critical resources that are needed for the page are fetched early, which can improve performance. Make sure to also specify the type of resource with the as attribute.

Among many, you can mark fonts, images, styles, scripts or videos and audios as a priority resource.

For the full list of available options, you can check out MDN's official documentation.

How to Load Resources With Priority in HTML
If you would like to see more Webtips, follow @flowforfrank

10 Best Practices for HTML

Resources:

  • twitter
  • facebook
HTML
Did you find this page helpful?
πŸ“š More Webtips
Frontend Course Dashboard
Master the Art of Frontend
  • check Access 100+ interactive lessons
  • check Unlimited access to hundreds of tutorials
  • check Prepare for technical interviews
Become a Pro

Courses

Recommended

This site uses cookies We use cookies to understand visitors and create a better experience for you. By clicking on "Accept", you accept its use. To find out more, please see our privacy policy.