简体   繁体   中英

How to disable Google Chrome's Cache?

I am modifying a WordPress site's appearance (minor modifications) but can't see the result on chrome because of annoying persistent cache. I tried shift+refresh but it doesn't work. how can i disable the cache temporarily or refresh the page in some way that I could see the changes?

thanks.

You should not modify your code to achieve this. If you are using Google Chrome as you said you should press Ctrl+Shift+j and go to Network tab. Check the Disable cache option and reload the page. Browser will display the response from the server (not from cache).

You can delete the browser cache by adding these headers in your header.php file :

<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
?>

Hope this will help you.

Regrads

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