dreamwest Posted March 3, 2011 Share Posted March 3, 2011 So i have a page cached with php pragma headers. How can i clear the cache when someone sets a cookie: <script> function set_cookie(object, value) { var expireDate = new Date() var expstring = expireDate.setDate(expireDate.getDate() + 500) document.cookie = object+'='+value+'; expires='+expireDate.toGMTString()+'; path=/'; window.location.reload() } </script> <a onclick="set_cookie('list', '1');" href="javascript:void('0');">Set cookie and clear cache</a> Quote Link to comment https://forums.phpfreaks.com/topic/229438-clear-cache/ Share on other sites More sharing options...
nogray Posted March 4, 2011 Share Posted March 4, 2011 You can simply generate a random number and add it to url query, for example window.location = my_url.php?random_number=1234455666 Quote Link to comment https://forums.phpfreaks.com/topic/229438-clear-cache/#findComment-1182646 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.