Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

92
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda