javascript - How to prevent Safari from loading back button cache? -


i've noticed common bug browser button usage on web app hitting button after logout loads cached page user appears logged in (though aren't actually).

i found lot of helpful questions helpful answers , employed fixes folks suggested, including every combination of suggested cache-control options in header:

('cache-control', 'no-cache, no-store, must-revalidate, max-age=0, max-stale=0') 

and header works on most browsers, no-cache , no-store, no header options solve on safari.

sure enough, reliable way can find resolve safari use javascript such forces reload:

<script>             window.onpageshow = function(event) {                 if (event.persisted) {                     window.location.reload();                 }             }; </script> 

the javascript block above does work, if user doesn't disable javascript via safari -> preferences -> security , subsequently hit button. it's edge case, i'm kind of fascinated such popular browser makes such trivial bug tricky!

if has found way make safari play nice without javascript i'd love hear how. in advance!


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -