Web Global Net Web Application & Web Development Project Center

Technical Issues => Javascripting => Topic started by: admin on August 25, 2021, 06:06: PM

Title: Forcing a browser page to reload when the back button is clicked to flush cache
Post by: admin on August 25, 2021, 06:06: PM
put this in the the head section

          * If browser back button was used, flush cache
          * This ensures that user will always see an accurate, up-to-date view based on their state
          * https://stackoverflow.com/questions/8788802/prevent-safari-loading-from-cache-when-back-button-is-clicked
         (function () {
            window.onpageshow = function(event) {
               if (event.persisted) {

Apple's own fix suggestion is to add an empty iframe on your page:

<iframe style="height:0px;width:0px;visibility:hidden" src="about:blank">
    this frame prevents back forward cache