How to programmatically empty browser cache?

前端 未结 11 980
迷失自我
迷失自我 2020-11-22 17:36

I am looking for a way to programmatically empty the browser cache. I am doing this because the application caches confidential data and I\'d like to remove those when you p

11条回答
  •  一个人的身影
    2020-11-22 18:05

    Initially I tried various programmatic approach in my html, JS to clear browser cache. Nothing works on latest Chrome.

    Finally, I ended up with .htaccess:

    
        Header set Cache-Control "no-cache, no-store, must-revalidate"
        Header set Pragma "no-cache"
        Header set Expires 0
    
    

    Tested in Chrome, Firefox, Opera

    Reference: https://wp-mix.com/disable-caching-htaccess/

提交回复
热议问题