Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

119
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda