Webflow sync, pageviews & more.
NEW

Does Webflow have a fix for the bug where the previous page does not appear when using the native browser buttons in Safari?

TL;DR
  • Add a JavaScript snippet to reload the page on Safari back navigation: window.onpageshow = function(event) { if (event.persisted) { window.location.reload(); } };
  • Ensure Page Load animations in Webflow are fully completed and avoid relying on hidden initial states that aren't reset properly.

Safari’s back button not properly displaying the previous page is a known issue that can occur in Webflow projects, especially when using page animations or interactions. Here's how to address it.

1. Understand the Cause

  • The issue typically arises due to Webflow’s Page Load animations or custom interactions (IX2) that don’t re-run correctly when returning to a page via the Safari back button.
  • Safari may use its page cache (bfcache), which preserves page state—including incomplete animations—when a user navigates using the browser’s back or forward buttons.

2. Use Webflow’s Built-in Page Load Trigger Correctly

  • If you're using Page Load animations, make sure they complete fully and don't rely heavily on hidden initial states that require JavaScript to reset.
  • Avoid setting key content to display: none initially and then fading them in, especially if that hide state is not reversed on a page re-show.

To force Safari to reload the page from cache properly:

  • Add this script inside your Page Settings > Custom Code > Footer section:

    window.onpageshow = function(event) { if (event.persisted) { window.location.reload(); } };

  • This ensures the page fully reloads when returning via the back button from Safari. It does not affect other browsers significantly.

4. Test in Private Mode or With Caching Disabled

  • To confirm the fix, test your project in Safari Private Browsing, where bfcache behaves differently, or clear your cache before trying again.

5. Consider Simplifying Interactions as a Last Resort

  • If the issue persists, audit whether your interactions are overly complex. Simplify or remove on page load animations or test if they behave better when moved to scroll-based triggers instead.

Summary

To fix the bug where the previous page does not appear properly in Safari when using the back button, add a JavaScript snippet to reload cached pages on return. This works around Safari’s bfcache quirks and helps Webflow animations reset correctly.

Rate this answer

Other Webflow Questions