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

145
Vistas
Are chrome user defined window values retained on page refresh/URL change

In the question, Persist variables between page loads, the accepted answer says that the data stored in window are retained.

It says,

The major difference is that this information is retained across not only page refreshes but also different domains. However, it is restricted to the current tab you're in.

When I tried writing to window object from chrome dev console and when navigated to some other page on the same domain, the values weren't retained.

This is what I did:

  1. Open https://stackoverflow.com/unanswered
  2. Open dev console and set window.testKey = "test-value"
  3. Navigate to a different page by clicking one of the questions link.
  4. Entering window.testKey in console returns undefined.

Also, a simple case of setting a value on window followed by a page refresh also doesn't seem to retain the value.

What am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The part you quote:

The major difference is that this information is retained across not only page refreshes but also different domains. However, it is restricted to the current tab you're in.

Is only about window.name, which is a special property, and this still works - to some degree - in current browsers.

Window.name:

Modern browsers will reset Window.name to an empty string if a tab loads a page from a different domain, and restore the name if the original page is reloaded (e.g. by selecting the "back" button). This prevents an untrusted page from accessing any information that the previous page might have stored in the property (potentially the new page might also modify such data, which might then be read by the original page if it was reloaded).

I the end it was just a hack and you should not rely on its functionality. For the same domain, you have localStorage or sessionStorage

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