Results 1 to 7 of 7

Thread: script question

  1. #1
    Senior Member
    Join Date
    Nov 2001
    Posts
    681

    script question

    does anyone no a script that will check someones screen resolution when they click to enter your site and then take them to the appropriate site? i have a vague idea one could be written, just don't feel like trying is someone has a standard one (debugging is a bitch). Thanks

  2. #2


    <SCRIPT LANGUAGE="JavaScript">
    <!--
    function redirectPage() {
    var url640x480 = "url"; //put the urlĀ“s here
    var url800x600 = "Url";
    var url1024x768 = "url";
    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= url800x600;
    }
    // -->
    </SCRIPT>
    </HEAD>


    <BODY onload="redirectPage();">

    that should do it

  3. #3
    Senior Member
    Join Date
    Aug 2001
    Posts
    130
    fairly similar......hope these help eh

    <SCRIPT LANGUAGE="JavaScript">
    browserName = navigator.appName;
    browserVer = parseInt(navigator.appVersion);
    if (browserName == "Netscape" && browserVer >= 4 || browserName ==
    "Microsoft Internet Explorer" && browserVer >= 4)
    version = "1";
    else if (browserName == "Netscape" && browserVer >= 3)
    version = "2";
    else
    version = "3";
    if (version == "1") {
    var correctwidth=800
    var correctheight=600
    if (screen.width<correctwidth||screen.height<correctheight)
    location="PAGE_FOR_LOW_SIZE.htm"
    else
    location="PAGE_FOR_HIGH_SIZE.htm"
    }
    if (version == "2") {
    var toolkit = java.awt.Toolkit.getDefaultToolkit();
    var screen_size = toolkit.getScreenSize();
    var correctwidth=800
    var correctheight=600
    if (screen_size.width<correctwidth||screen_size.height<correctheight)
    location="PAGE_FOR_LOW_SIZE.htm"
    else
    location="PAGE_FOR_HIGH_SIZE.htm"
    }
    if (version == "3")
    location="DEFAULT_PAGE.htm"
    </SCRIPT>

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    681
    thanks guys... i'll test the them and see which i like better
    Learn like you are going to live forever, live like you are going to die tomorrow.

    Propoganda

  5. #5
    Senior Member
    Join Date
    Nov 2001
    Posts
    1,255
    Why not just simply write the site to fit to 800x600 and be done with it? That's how a lot of sites do their things (ZDNet, for instance). On 640x480 you have to scroll, and on 1024x768 you get space at the sides.
    Chris Shepherd
    The Nelson-Shepherd cutoff: The point at which you realise someone is an idiot while trying to help them.
    \"Well as far as the spelling, I speak fluently both your native languages. Do you even can try spell mine ?\" -- Failed Insult
    Is your whole family retarded, or did they just catch it from you?

  6. #6
    Senior Member
    Join Date
    Sep 2001
    Posts
    201
    Design a site for the lower resolution users!! bad examples of web site design is http://uk.php.net Notice how in lower resolutions you have to scroll to the right?? They could have solved this by having the cells fit a certaoin percentage of the screen! This means all resolutions have a good deal!

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    681
    chsh - i like 1024 better so it was easier to make 2... which i did. no problems.
    Learn like you are going to live forever, live like you are going to die tomorrow.

    Propoganda

Posting Permissions

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