Pain Posted January 9, 2013 Share Posted January 9, 2013 Hi. I have a very common problem, IE caches stuff, so in order to see new things come up i must reload all page. function mountOne() { var myurl = 'mount_shotgun.php'; myRand = parseInt(Math.random()*99999999); // cache buster var xmlhttp2; if (window.XMLHttpRequest) { xmlhttp2 = new XMLHttpRequest; } xmlhttp2.onreadystatechange = function() { if (xmlhttp2.readyState == 4 && xmlhttp2.status == 200) { document.getElementById("retrieve").innerHTML=xmlhttp2.responseText; } } $('#inventory_item1').css("background-image", "url('images/shotgun.png')"); xmlhttp2.open("GET", myurl + "?rand=" + myRand, true); xmlhttp2.send(); } My attempt to bust it using a random token was unsuccessfull var myurl = 'mount_shotgun.php'; myRand = parseInt(Math.random()*99999999); // cache buster I would gladly appreciate any kind of help. Thank you. Link to comment https://forums.phpfreaks.com/topic/272913-cache-busting/ Share on other sites More sharing options...
Christian F. Posted January 10, 2013 Share Posted January 10, 2013 You can just set the HTTP cache headers, in order to stop the browser (or anything else) from caching the pages. Link to comment https://forums.phpfreaks.com/topic/272913-cache-busting/#findComment-1404664 Share on other sites More sharing options...
Pain Posted January 10, 2013 Author Share Posted January 10, 2013 i've tried header("Cache-Control: no-cache, must-revalidate"); header("Pragma: no-cache"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); but nothing has changed.. Link to comment https://forums.phpfreaks.com/topic/272913-cache-busting/#findComment-1404808 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.