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

118
Visualizações
How to hard reload/refresh a page using javascript

How do we do a hard reload/refresh in Chrome using Javascript?

window.location.reload(true);
location.reload(true);

didn't do it for me.

===========================

What I meant by 'didn't do it for me...'

The session cookies (ex. JSESSIONID) were not renewed specially the HttpOnly ones.

What I want to achieve...'

  1. I wanted to reload the page like it's the first time I accessed the URL.
  2. I wanted to simulate the steps below (which is like accessing the URL for the first time)
   - Open browser
   - Type URL
   - Hit Enter

I wonder if there is a more powerful Javascript command that reloads as if it is the first time.

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

location.reload() should work. Works for me!

about 4 years ago · Juan Pablo Isaza Relatório

0

The best (and practically only) way to ensure a page is hard reloaded is by using your server. One of the ways you can do this is by serving headers, when a page is requested, that invalidate resources such as Cache-Control which will tell the browser to not cache resources and always revalidate resources which means everything must be redownloaded each time.

I would not recommend serving this header on every request in your production application, though.

Cache-Control: no-store, max-age=0

On your page you can add meta tags that will tell the browser what to do, provided there weren't headers already passed to the browser. This depends on how you serve your content, but you can add the following to your head element which will tell the browser to store absolutely nothing and is equivalent to hitting a page for the first time:

<head>
...
<meta http-equiv="Cache-Control" content="no-store, max-age=0">
...
</head>
about 4 years ago · Juan Pablo Isaza 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