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

247
Visualizações
Cache Busting Options for Javascript

I know there are a few posts on this around on cache busting but I was wondering if I could get a bit of help with summarizing options for cache busting, see if I've missed any. It is a significant issue with the enterprise webapp I maintain and customize as a Web Dev / Sys Admin.

From what I have seen, the most reliable is to create different versions of the file for each change, based on a time stamp or similar. File versioning has been used in the past by other admins prior to my time, at a basic level (something1.js, something2.js). Problem is we don't have a good method in place for this and the application itself has a lot of dependencies between pages from years of customization.

Recently, I tried adding a simple script that adds a cache-control Meta tag in the header to try to force reload of the files if older than 1 week. Here is my very rudimentary attempt at it.

let headForCacheControl = document.querySelector("head");
let cacheControl = document.createElement('meta');
cacheControl.setAttribute('http-equiv','cache-control');
cacheControl.setAttribute('content','must-revalidate max-age=604800');
headForCacheControl.appendChild(cacheControl);

Any feedback on this approach, any other options beyond these two, or advice on implementing file versioning is very welcome.

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