22 users online (0 members and 22 guests)  


  Results 1 to 8 of 8

Related

  1. Changing Resolution    Forum: HTML Forum
    Replies: 3
  2. Resolution Conflicts    Forum: HTML Forum
    Replies: 4
  3. Detecting Resolution    Forum: HTML Forum
    Replies: 5
  4. resizing resolution    Forum: HTML Forum
    Replies: 1
  5. Screen Resolution    Forum: HTML Forum
    Replies: 9
  1. #1
    Tech1254's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Edmonton
    Posts
    4

    Detecting Resolution

    Hey all. couldn't find the introductions page so make this my question and intro. So hey i'm Tech1254 i work for Shaw Cable as a tech support rep and i'm offically crashing this party fortunatly i bring beer......
    anyway on to the questions. I have seen certain sites and even remember seeing the code that will force ie to load a different site based on the resolution detected.
    eg. detected resolution = 800x600 load home86
    while detected resolution - 1024x768 load home107
    i belive the code i saw for this was asp.net but i don't know asp so i was wondering if any of you might happen to know a html trick or even a html/java hybrid that could pull this off.
    just sick of using iframes percentages and adaptive backgrounds its gettin old lol.
    lets me know if ya have ideas.

  2. #2
    Tech1254's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Edmonton
    Posts
    4

    Re: Detecting Resolution

    sorry bout the double post... just had another thought that might make it workable..... once again don't know any code that could do it.
    thought is stick with the iframes but load selected graphics based on resolution.
    check out what i have at the moment best viewed in 1024x768 but if viewed in 1280x1024 you'll see my problem

    http://www.members.shaw.ca/tech1254/

    this is the old site using percentage for iframe widths

    http://www.members.shaw.ca/sniping_viper_1/

  3. #3
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Detecting Resolution

    Welcome to the forums
    Just place this code within the head tags and insert the url to redirect the user to for each different format.
    Code:
    <script>var width = screen.width;var res =(((!(640-width))*1)+((!(800-width))*2)+((!(1024-width))*3)+((!(1152-width))*4)+((!(1280-width))*5)+((!(1600-width))*6)); if(!(res)) res = 1;if (res=='1') {window.location='http://www.ahfb2000.com'}if (res=='2') {window.location='http://www.ahfb2000.com'}if (res=='3') {window.location='http://www.ahfb2000.com'}if (res!='1' && res!='2' && res!='3') {window.location='http://www.ahfb2000.com'}</script>
    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  4. #4
    Tech1254's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2006
    Location
    Edmonton
    Posts
    4

    Re: Detecting Resolution

    beautiful. thanks for your help its appreciated. i'll be around. belive me!!

  5. #5
    DeadMeatGF's Avatar
    Moderator

    Status
    Offline
    Join Date
    Sep 2005
    Posts
    381

    Re: Detecting Resolution

    Very nice - I think you could adapt that technique to load custom style sheets for different resolutions, too - unless there's a better way?

  6. #6
    HTML's Avatar
    Administrator

    Status
    Offline
    Join Date
    Aug 2000
    Posts
    3,445

    Follow HTML On Twitter Add HTML on Facebook Add HTML on Google+ Add HTML on Linkedin Visit HTML's Youtube Channel

    Re: Detecting Resolution

    I thought I remembered Quietdean posting something like this in the CSS forum but I cannot find it now.

    Dave
    AHFBWEB Less customers per server, more power for you!

    Business Class Shared Hosting

  7. #7
    kjmadd's Avatar
    New User

    Status
    Offline
    Join Date
    May 2008
    Posts
    1

    Re: Detecting Resolution

    I found this thread by Googling "detecting browser" because I am working on a site that uses frames and the mainframe has an image map on one of the pages. Is there any way to use the script you put on this thread to re-direct to alternative pages within frames according to the visitor's resolution setting?

  8. #8
    JamesonLewis3rd's Avatar
    New User

    Status
    Offline
    Join Date
    Feb 2007
    Location
    Arlington TX
    Posts
    11

    Re: Detecting Resolution

    Using Yahoo!, I googled "javascript resolution css" (without the quotes) and found several sites with good code which detects browser resolution and then (depending on the result) applies the appropriate CSS.
    Last edited by JamesonLewis3rd; 06-14-2008 at 08:11 PM. Reason: clarity



Tags for this Thread