I don’t know how to write JS but I’m working on a site and I need to reload animated graphs when press on the browser back button.
I found this script below that kind of works but before it reloads the pages it scrolls top in a not fluid way and I’d like to avoid that. Ideally I think I’d love a fade out effect.

I’m using WordPress.

window.onpopstate = function(event) { 
    window.location.reload();
};

Any help would be great!
Thanks

Read more here: Reload page with Back Button. Not reloading graphs correctly


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: