Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

221
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda