Jump to content

Cache busting


Pain

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.