Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

224
Views
How can I get safari to pre-load js / css assets?

I've been trying to get Safari to start pre-loading assets while a page is loading but nothing seems to work. Chrome and Firefox seem to do it just fine though.

The setup is simple enough. A script renders the following html with a 2s pause in the middle. The first part of the response has been flushed out and streamed to the browser. This is confirmed by Firefox and Chrome's ability to start fetching the js early.

<!DOCTYPE html>
<html lang="en">

<head>
    <link rel="preload" href="http://localhost:8888/js.js" as="script" />
    <script href="http://localhost:8888/js.js"/>

</head>
<!-- here the script rendering the HTML would actually pause 
    for 2s before rendering the rest of the document -->
<!-- the first part of the response has been 
    flushed and sent to the browser already -->
<body>
</body>
</html>

Fetching the JS file also has a 2s delay added to it. This makes things easy to visualize in browser timelines.

Note that Chrome & Firefox will start loading the JS early even if no <link preload> is present. They seem to just start parsing the HTML as soon as they get a bit of it and download any js they encounter along the way.

On Firefox I get the following waterfall: Firefox Waterfall

On Chrome I get about the same: Chrome Waterfall

On Safari however all I ever can get is:

Safari waterfall

Which clearly shows Safari not trying to asynchronously load the script and instead waiting for the full html response to be received.

What am I missing? Does safari just not do any asset pre-loading at all?

almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

At the moment, Safari doesn’t support <link rel=preload>, which explains the waterfall you’re seeing. The good news is that Jen Simmons, one of their Web Evangelists, has asked on Twitter what developers would use it for if it existed.

almost 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!