Improved Mikes hack to ease testing against IE cache

This commit is contained in:
Jörn Zaefferer 2006-12-31 15:09:07 +00:00
parent c3d8cb0c09
commit 4c66f62a6f
3 changed files with 48 additions and 31 deletions

View file

@ -3,5 +3,5 @@ html text<br/>
testFoo = "foo"; $('#foo').html('foo');
ok( true, "test.html executed" );
/* ]]> */</script>
<script src="data/test.js"></script>
<script src="data/test.js?<?php srand(); echo time() . '' . rand(); ?>"></script>
blabla

View file

@ -191,4 +191,17 @@ function t(a,b,c) {
for ( var i = 0; i < f.length; i++ )
s += (s && ",") + '"' + f[i].id + '"';
isSet(f, q.apply(q,c), a + " (" + b + ")");
}
/**
* Add random number to url to stop IE from caching
*
* @example url("data/test.html")
* @result "data/test.html?10538358428943"
*
* @example url("data/test.php?foo=bar")
* @result "data/test.php?foo=bar&10538358345554"
*/
function url(value) {
return value + (/\?/.test(value) ? "&" : "?") + new Date().getTime() + "" + parseInt(Math.random()*100000);
}