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

114
Vistas
how to use js function after using windows.location.replace

Is it possible to run a js function\script after using already the windows.location.replace to get to a new website.

I need to use the script after the page load with the parameters I provide.

All my code is in html file running the scripts.

const today = new Date()// date
        var month =today.toLocaleString('default', { month: 'long' });// get the month 
        var day = today.getDate();//get the  Day
        var hour = today.getHours();//time 
        var month = today.getMonth() +1;
        var year = today.getFullYear();
        var filteredURL = `the website with the parameters`
        sessionStorage.setItem("reloading", "true");
        window.location.replace(filteredURL);

      window.onload = function() {
    var reloading = sessionStorage.getItem("reloading");
    if (reloading) {
        sessionStorage.removeItem("reloading");
        myFunction(console.log(test));
    }
}

// function reloadP() {
//     sessionStorage.setItem("reloading", "true");
//     document.location.reload();
// }

any help will be welcome. thanks in advance.

about 4 years ago · Juan Pablo Isaza
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