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

94
Vistas
DOM of new page inaccessible after window.location.href value changes

I've a rating submission form. In form.onSubmit(), I capture the rating data, redirect to a "thank you page" with window.location.replace(url).

I'm trying to append the rating data in the new page. However, once the page is replaced, I can access the formData variable, but, DOM of the new page seems inaccessible.

Code:

const form = document.querySelector('form');

function handleSubmit(e) {
  e.preventDefault();

  const formData = new FormData(form);

  window.location.replace('thankyou.html');

  console.log(formData.get('rating'));
  
  // dom not accessible after replace
  console.log(document.body);
}

Any leads?

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

0

For future ref., it seems all content and attached resources are removed on page reload/redirect.

Another similar query: set timeouts invalidated by page reload

Resources: MDN window event - unload

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