Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

89
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!