How about this...
Code:
<script type="text/javascript">
<!--
function setBandwidth(whichVal){
var expdate = new Date();
expdate.setTime(expdate.getTime() + (60*60*24*365));
document.cookie = 'setbandwidth=' + whichVal + '; expires=' + expdate.toGMTString() + '; path=/';
}
BCt=new Date();
BCs=BCt.getTime();
function bandwidthDetect() {
var args=bandwidthDetect.arguments;
var el=(document.layers)?document.layers['Layer1'].document.Myimage1:document.Myimage1;
if(el.complete){
BCt=new Date();
BCe=BCt.getTime();
BCd=(BCe-BCs)/1000;
if(document.cookie.indexOf('setbandwidth=1')>=0) {
location.href=args[1];}else
if(document.cookie.indexOf('setbandwidth=2')>=0) {
location.href=args[2];}else
if(BCd<args[0]){setBandwidth(1);location.href=args[1];}else
if(BCd>=args[0]){setBandwidth(2);self.location.href=args[2];}
}
}
//-->
</script>
Then place this in your "body tag"
Code:
<body onload="bandwidthDetect('4.5','300k.php','56k.php')">
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:100px; height:100px; z-index:1; visibility: hidden">
<img src="45k_image.jpg" alt="loadImage" width="100" height="100" border="0" name="Myimage1" /></div>
</body>
Found this little piece somewhere.
Bookmarks