...

View Full Version : determine processor speed with javascript?



mtgentry
03-21-2005, 09:16 PM
Hi All,

Im trying to determine a users processor speed via the setTimeout() function. Then according to the result I want them to get redirected to a fast or slow version of my site.

This is what I have so far. I think my problem occurs around the "//redirect stuff" section but Im not certain. Thanks in advance for any suggestions!





<script language="JavaScript">
function myFunction() {
var date2 = new Date();
alert('interval = ' + (date2.getTime() - date1.getTime()) + ' milliseconds');
}
var date1 = new Date();
setTimeout('myFunction()',0); // no delay

//redirect stuff
if('myFunction()'<50){
window.location="http://www.google.com"; //fast computer
}
else{
window.location="http://www.yahoo.com"; //slow computer
}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum