Results 1 to 13 of 13

Thread: Resolution redirection

  1. #1

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568

    Resolution redirection

    I am trying to redirect the user to the right resolution version of my site when s/he clicks on the enter button on the splash page.. I know this can be done but my code doesn't work... can someone help me?

  2. #2
    chenko
    Guest
    this is from a stats counter, somewhere in there it logs the screen res... this is assuming your talking about using ASP?


    also, here are some javascript/html files, this is really old, and I think there might be somit there
    http://members.aol.com/vbchenko/codehtml/applets.htm

  3. #3

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    I am sure that I managed to do it in JavaScript... I am sure of it... but I think that ASP will do it too.. I looked through your list there is nothing ther mate.. sorry.. Thanks for your help anyway...

  4. #4
    chenko
    Guest
    DAMN!! how the heck does it log the res then?? ummmm

  5. #5

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    Found out how... I knew I had it somewhere!!!! It sends a request to the computer to find the screen res.. it then redirects you to the correct site!

    Its done like this:

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function redirectPage() {
    var url800x600 = "http://www.yoursite.com/800x600";
    var url1024x768 = "http://www.yoursite.com/1024x768";
    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>

    With the relevant loations of course.. Then in the button for the actual link add :

    onClick="redirectPage()"

    I thought that it was something like that!!!!!

  6. #6
    chenko
    Guest
    if its any help here is the config.asp page that was included into that file i sent you.

  7. #7
    chenko
    Guest
    Ok, I just decided to send you the whole stats program... I know it logs the res...but i dont know where

  8. #8
    chenko
    Guest
    Originally posted by chrismitchell
    Found out how... I knew I had it somewhere!!!! It sends a request to the computer to find the screen res.. it then redirects you to the correct site!

    Its done like this:

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    function redirectPage() {
    var url800x600 = "http://www.yoursite.com/800x600";
    var url1024x768 = "http://www.yoursite.com/1024x768";
    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>

    With the relevant loations of course.. Then in the button for the actual link add :

    onClick="redirectPage()"

    I thought that it was something like that!!!!!

    nice!! I think i will save that

  9. #9

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    I thought that I almost had it then I looked on a mates site that I knew used it and stopped it at the right time!!! Bloody useful I will have to send him an email to thank him! lol!

  10. #10
    chenko
    Guest
    ...and he dont get a extra post either

  11. #11

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    fair enough... well I'm sure that the code above will help people..

  12. #12
    chenko
    Guest
    yea, Im too lazy to do my site, let alone ones for different resolutions

    BTW what was the name of that book you suggested a while back?

  13. #13

    Thread Starter
    Fanatic Member chrismitchell's Avatar
    Join Date
    Jan 2001
    Location
    With Hobbes in New Zealand
    Posts
    568
    Which book? For JavaScript: I recommend you get the O'Reilly book because it is a really good reference book, but to start with get the Visual Quickstart book for JavaScript as it is a good way to start in JavaScript.

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