Force refresh page when user taps browser back button

Hello!

I have had to solve this issue in the past, specifically for Safari users since Safari slides back to the exit state of the previous page when going back. Below is the custom code that worked for me to accomplish this:

/* If browser back button was used, flush cache */
(function () {
	window.onpageshow = function(event) {
		if (event.persisted) {
			window.location.reload();
		}
	};
})();

This is the article where the code originally came from as well: