First, I tried a server-side solution. At header.php of my theme I added at top the following code (where ‘myPageTitle’ corresponds to the page which shall not be cached)
if($_SERVER['REQUEST_URI'] =="/myPageTitle/")
{
header("Pragma: no-cache");
header("Cache-Control: no-cache, no-store, max-age=0, must-revalidate");
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Connection: close");
}
Interestingly, this works well, but not with Safari browser. Does anyone know why?
For Safari the following JavaScript trick works for me:
if (window.location == "http://www.myDomain.com/myPageTitle/" || window.location == "http://www.myDomain.com/myPageTitle/#") {
window.onpageshow = function(event) {
if (event.persisted) {
window.location.reload();
}
};
}