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

555
Vistas
How do you trigger an event when the URL changes without the page reloading in javascript?

For example, if I click the 'next' button on a webpage, the website displays the results of the next page but does not reload the page, whilst the URL changes. How would I detect this change in URL and trigger an event accordingly on the newly displayed page?

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

0

After click 'next' button you would do action which get new URL address and do action based on the new data.

For example:


nextBtn.addEventListener('click', () => {
  const currentLocation = window.location;
  // here you can get data from URL and do whatever you want with it
});

But you can also use library like rxjs to subscribe url from others files.

For example:

file1.js

nextBtn.addEventListener('click', () => {
  const currentLocation = window.location;
  publisher.next(currentLocation);
});

file2.js
publisher.subscribe(location => {
  // and you have your url data in another file
});

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