Streaming live at 10am (PST)

Browser back button doesn't trigger interaction on an anchor link

*EDIT this seems to happen on all links using the back button. Won’t load the load trigger, added the share link here: *

Hi everyone
I have a problem with my interactions when you hit the back button on the browser.

At the loading of a page I have an interaction where everything in the fades in from 0% opacity.

If you go to a normal link back the animation works right but if you go back to an anchor link it won’t trigger the animation.

You can see an example here:

Just click on any of the projects then click the browser back button on a Mac using Safari or Firefox and it will come to a blank page.

I found someone who wrote some JS to have it go back two clicks but this doesn’t work for me because I think they assigned it to a button on the page with a class (.back-button).

Here is that code:

<script type="text/javascript">
    $(".back-button").click(function(e) {

        e.preventDefault();  // This will prevent the default link behavior

        if(window.location.hash) {  // This checks to see if there is a "#" in the current url
          window.history.go(-2);  // If so, this will navigate the browser back by 2 pages  
        } else {
          window.history.go(-1);  // If not, this will only navigate back by 1 page

Is there something I can change in that code to make it work or is there another workaround people can think of?


Anyone? I couldn’t find an example of this in the forums. Should I log it as a bug?

Hi @esoteric_designs, this is just behavior on the browser, to not reload the page on back click, therefore, any load triggers will not execute.

This article from stackoverflow may help:

Also, just a tip, since it involves custom code, it is good to put this kind of question in the Code Help category :slight_smile:

I hope this helps!

This topic was automatically closed after 60 days. New replies are no longer allowed.