Results 1 to 4 of 4

Thread: Detecting the screen resolution

  1. #1

    Thread Starter
    Lively Member Crazy_bee's Avatar
    Join Date
    Jul 2001
    Location
    Fitchburg
    Posts
    90

    Arrow Detecting the screen resolution

    does anyone know how i can use some javascript to detect the user's screen resolution?
    Thanks
    Don't ever Ginop before you Ginip

  2. #2
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    there is a way... here is how I did it, though I did it to re-direct them to the version of the site that they would be able to see (either 1024x768 or 600x800) though you could use it for more than that amount of resolutions!

    Put this bit in the < head >

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function redirectPage() {
    var url800x600 = "indexlinks800.htm";
    var url1024x768 = "indexlinks1024.htm";
    if ((screen.width == 640) && (screen.height == 480))
    window.location.href= url640x480;
    else if ((screen.width == 800) && (screen.height == 600))
    window.location.href= url800x600;
    else if ((screen.width == 1024) && (screen.height == 768))
    window.location.href= url1024x768;
    else window.location.href= url640x480;
    }
    // End -->
    </script>


    And put this bit in the button (if you are using a button)

    onClick="redirectPage()"


    I hope that this helps..

  3. #3
    scoutt
    Guest
    hey chris, I was looking at that code and noticed something that might make it not work.

    where is this var - url640x480

    just thought you would like to know, or maybeI missed something.

  4. #4
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    I don't have a 640x480 version of the site.. if there is anything there that states 640x480 then it is not meant to be there!

    Cheers for having a look Scoutt.

Posting Permissions

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



Click Here to Expand Forum to Full Width