How to reload a page after an external link visit then use of browser back?

@watercannon
Thu, 04 Sep 2025 12:22:10 +0000

Hi,

When my app page gets updated via turbo-stream and fetch+JavaScript, and the browser back button is used after an external link has been visited from that page, the page state before any of the updates is shown. What’s the best way to have the updated page reloaded from Turbo-cache or server after a back so that the latest version of the page is shown?

The page is still shown in its original state even after adding expires_now to the controller action.

But I have got it to reload the page by adding

history.pushState(null, "", location.pathname + "?" + Date.now());

to a click handler for the external link.

Is this the only solution despite the unwelcome URL?

Thanks,

Mark