How to show different site to different web browsers

Discussion in 'HTML & Website Design' started by ponpulla, Dec 1, 2010.

  1. #1
    okay i have a site and want to show a different site to each browsers.

    so say i want Site A to only be seen by chrome and firefox

    and i want Site B to only be seen by IE and Opera.
     
    ponpulla, Dec 1, 2010 IP
  2. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #2
    I think it is possible, with JavaScript can do this may be, determine browser and do what you want.
    Webmasters may have other option I guess.
     
    radiant_luv, Dec 1, 2010 IP
  3. ponpulla

    ponpulla Peon

    Messages:
    538
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #3
    yeah i figured it can be done with javascript, But i have no clue to how to even begin this, i looked at some scripts googling but most of em are from like 2004 that didnt work when i tried to put them on my test site
     
    ponpulla, Dec 1, 2010 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    This would normally be done server side by detecting the user agent string. This is also considered bad practice unless you have some reason for promoting a product specific to a browser. User agent strings aren't highly reliable overall since they can be spoofed.
     
    drhowarddrfine, Dec 2, 2010 IP
  5. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #5
    Yes, is there any specific reason to do so? It's kinda strange.

    Server side is the best option.I did on something similar note but on the frontend using JavaScript.
     
    radiant_luv, Dec 2, 2010 IP
  6. koula

    koula Peon

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you mean different style change the CSS with javascript

    if(firefox)
    {
    CSS1
    }

    if(IE)
    {
    CSS2
    }
     
    koula, Dec 2, 2010 IP
  7. ponpulla

    ponpulla Peon

    Messages:
    538
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #7
    i got to do this cause i just got tired of trying to fix my landing page to work on both IE and Opera, they just refuse to show my iframe.
     
    ponpulla, Dec 2, 2010 IP
  8. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #8
    Then you're coding it wrong. Neither have any issues with iframes.
     
    drhowarddrfine, Dec 2, 2010 IP
  9. ponpulla

    ponpulla Peon

    Messages:
    538
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #9
    You right man, it just got me beat lol but now im back with my motivation to fix it cause i dont like the browser redirection idea really. and plus eventually i will have to figure it out. maybe ill post my site source and someone can help me.

    but anyways for anyone need a answer for i originally asked, here something i came across i tweaked it a bit to fit my needs, but it redirects by detect the user agent.

    
    
    <html>
    <script>
    if(navigator.userAgent.indexOf("Firefox") != -1)
    {
       window.location = "http://yahoo.com/";
    }
    else if(navigator.userAgent.indexOf("MSIE") != -1)
    {
       window.location = "http://youtube.com/";
    }
    else if(navigator.userAgent.indexOf("Netscape") != -1)
    {
       window.location = "http://bing.com/";
    }
    else if(navigator.userAgent.indexOf("Chrome") != -1)
    {
       window.location = "http://google.com/";
    }
    else if(navigator.userAgent.indexOf("Opera") != -1)
    {
       window.location = "http://stagevu.com/";
    }
    else
    {
       window.location = "http://hulu.com/";
    }
    </script>
    </html>
    
    
    Code (markup):
     
    ponpulla, Dec 2, 2010 IP
  10. GWiz

    GWiz Peon

    Messages:
    359
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    0
    #10
    GWiz, Dec 3, 2010 IP
  11. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #11
    If that's how your markup starts, are you using a doctype?
     
    drhowarddrfine, Dec 3, 2010 IP