Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Mar 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    determine processor speed with javascript?

    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!




    Code:
    <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>
    Last edited by mtgentry; 03-22-2005 at 01:11 AM.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •