On Safari Load interactions do not trigger on Back Button press

Hi Webflow,

I found a small bug. On my new website I added a load interaction on the body of all pages. When the page is loaded the opacity goes from 0 to 100%. Which give’s it a nice and smooth transition. This works fine when you navigate through the website. But on Safari when I press ‘previous’ on the native browser buttons the previous page will not appear. It will when i reload the page.


Here is my public share link: https://preview.webflow.com/preview/lux-expo?preview=c350b84b226a77aaa968105544cfaf31

What’s the live site URL?

The site is online and the URL is: www.lux-expo.nl

try to play a wait for assets to load on the interaction and tell me if it works.

Hi @martijnrunia, thanks there is behavior with Safari that does not reload the page on back button press, thus the page load never triggers in that scenario.

Take peek here at this stack overflow article: javascript - Prevent safari loading from cache when back button is clicked - Stack Overflow

I have not tried this yet, but here is some jquery to paste in the before body section of custom code: http://help.webflow.com/faq/how-to-add-custom-head-and-body-code-to-a-webflow-site

<script>
$(window).bind("pageshow", function(event) {
    if (event.originalEvent.persisted) {
        window.location.reload() 
    }
});
</script>

I hope this helps!

7 Likes

Unfortunately that doesn’t change anything.

Hi @cyberdave thanks for your reply. I’ve added the code snippet to custom code head code section. Unfortunately this does not do the trick. Do I need to change anything in the jQuery code?

Thanks

Hi @martijnrunia, thanks, put the code in the Footer of the custom code, not the head, as jQuery is not yet loaded when the script is run in the head.

I this what you are trying to achieve? With the custom code, this is how it works for me when I press the back button:

https://cl.ly/3y1c0Q290h31/Screen%20Recording%202016-11-27%20at%2010.00%20PM.gif

Hopefully I am understanding the issue correctly.

Thanks!

4 Likes

Cool Thanks that definitely did the trick! It now works perfectly.

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