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

90
Vistas
Trigger a function when user went browsing back

I have a page that is a bit long to load, so I added a spinner to load when the user click on a link to this page. On Chrome, when the user click on this page (and get the spinner displayed to show the page is loading), when the user is on the long processing page, then decide to get back, the spinner is there again.

The user has to manually reload the page to get rid of the spinner. On Firefox it's fine. I use to listen to popstate to execute a code to hide the spinner. But unfortunately this doesn't work anymore on new version of Chrome.

Here is what I used to have and it used to works for Chrome:

  $(document).ready(function () {
    if (window.history && window.history.pushState) {
      $(window).on('popstate', function () {
        loading.hide(); // this is the code to hide my spinner
      });
    }
  });

To make it simple, I need a script that would be triggered only when user went back on a page.

almost 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