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

202
Vistas
'Uncaught TypeError' only on first page load only in Chrome on desktop. Works on second or more page loads. What is happening?

I have this problem that only exists on first page load in Chrome on desktop. It works in Chrome on the second or more page loads. It also works on mobile in Chrome on every page load.

It works fine in Safari and Firefox, MOST OF THE TIME. I have experienced the below error there as well, only on first page load, only on desktop, but I am not able to reproduce it there for about an entire day now.

Does anyone know what is going on?

The only thing I have been able to come up with is that somehow my redirect function is triggered. Because as you can see in the flow indicated below at number 6, after the error, the page redirects back to index.html. However that function would only trigger if the value of one of my sessionStorage values is null and I can see in the browser console that those values are set correctly when I press the button to go to the next page.

The error:

pic of error code

The flow:

  1. Landing page is index.html with separate index.js
  2. Upon selection of a few drop-downs, 3 values are stored in sessionStorage
  3. Next page is called: normal-quiz.html with separate normal-quiz.js
  4. Values from sessionStorage are retrieved to filter a data array
  5. The loadQuiz function runs on the filtered array and sets a question element value to an object's 'english' property
  6. On first page load, only in Chrome on desktop, the above error occurs which makes the browser return to index.html and sessionStorage is cleared
  7. If I try the above again, it works without a problem

The line generating the error is where I use the loadQuiz function to set the question element's value in my html to the 'english' property value of the first object in the filtered array.

The code (js):

function redirect() {
if (selectedBook !== null) {
    // do nothing
} else {
    window.location = "<myURL>"
};
};

redirect();

function loadQuiz() {
const currentQuizData = quizArr[currentQuiz]; // currentQuiz is the question counter. It starts at 0 to get the first object, then increments by 1 after each question

questionEl.innerText = currentQuizData.english;
// line above is where the error is generated

counter.innerText = (currentQuiz + 1) + "/" + quizArr.length;
};
loadQuiz();
about 4 years ago · Santiago Trujillo
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