简体   繁体   中英

Avoid Chrome saving .txt and .php files to cache

I am developing a web page (2075.mooo.com, (it is in Catalan)) where teachers control students' arrivals with an NFC card in an Arduino.

The thing is that I save students' data on.txt files, but Chrome saves those to its cache, and I have to constantly remove the cache files. Is there a way to not let Chrome do that or use another strategy instead of.txt files? Because I cannot say to all teachers and students to remove their chrome cache.

Thanks.

If using Apache:

Add this to a .htaccess file created in the directory you save the.txt files:

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

OR

If you have access to httpd.conf, you can add the following to it:

<LocationMatch ".*\.txt">
     Header always set Pragma "no-cache"
     Header always set Cache-Control "no-store, must-revalidate"
     Header always set Expires "0"
</LocationMatch>

They must clear the cache that they already have in their browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM