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

185
Visualizações
CSS and JS files loading twice for preloaded assets in safari

I have an html page which is being served by my node server, the HTML string is generated on the server side and the js and css files are preloaded, attached code below. I see that in safari these assets are being loaded twice which causes a flash of unstyled content on my application page, what actually happens is due to this duplicate loading, the JS hydration and actions starts before CSS loads completely. Any help would help

NOTE: This happens only in safari

<!DOCTYPE html>
<html>

<head>
  <title>Page Title</title>

  <link rel="preload" as="script" href="/build/vendor.93cdba92ba41a9a0915e.js" />
  <link rel="preload" as="script" href="/build/main.dfb07bf2ef463aa43736.js" />

  <link rel="preload" href="/build/main.18.8f76beb6dd5628871221.css" as="style" onload="this.onload=null;this.rel='stylesheet'" />

  <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1">
</head>

<body>
  <div style="z-index: 3" class="header" id="desktop-headerMount"> Header here</div>

  <div id="mountRoot" class="" style="min-height:1000px;margin-top:-2px;">
    // React App Will Mount Here
  </div>

  <div id="web-footerMount"> Footer Here </div>
  <script src="/build/vendor.93cdba92ba41a9a0915e.js"></script>
  <script src="/build/main.dfb07bf2ef463aa43736.js"></script>
</body>

</html>

Attaching a screen shot of the network tab too below, the css and js files are loaded twice.

This happens only in safari though, in Chrome it works fine

Network Tab Screenshot

Edit

I realise this at times depends on network speed, im wondering if some sort of race condition is happening, where before preload completes if my html parser reaches the script tag then this may happen i guess?

about 4 years ago · Juan Pablo Isaza
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