Project / Support Center
Welcome, Guest. Please login or register. October 24, 2021, 01:47: PM
Home Help Search Login Register
D-Web Web Site Creator D - Web Web Site Creator On-line HTML Editor No Programming knowledge required. Web Global Net PayPal-Cart Shopping Cart System PayPal - Kart Shopping Cart System for E-Commerce over the internet, that's easy to use. Web Global Net Newsletter Manager Newsletter Manager On-line Newsletter Creator with Email Subscriber Management.
Ring Central Discount
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  Javascripting  |  Topic: Forcing a browser page to reload when the back button is clicked to flush cache 0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Send this topic Print
Author Topic: Forcing a browser page to reload when the back button is clicked to flush cache  (Read 132 times)
admin
Administrator
******
Offline Offline

Posts: 229


« on: August 25, 2021, 06:06: PM »

put this in the the head section


<script>
         /**
          * 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) {
                  window.location.reload();
               }
            };
         })();
      </script>


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
</iframe>
Report to moderator   Logged

The Unknown Webmaster
Pages: [1] Go Up Send this topic Print 
Web Global Net Web Application & Web Development Project Center  |  Technical Issues  |  Javascripting  |  Topic: Forcing a browser page to reload when the back button is clicked to flush cache « previous next »
Jump to:  


Login with username, password and session length
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!