View Full Version : determine processor speed with javascript?

03-21-2005, 10: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
window.location="http://www.google.com"; //fast computer
window.location="http://www.yahoo.com"; //slow computer