Help me: Redirecting users to another page depends of browser

Discussion in 'HTML & Website Design' started by theivo, Sep 27, 2008.

  1. #1
    Hi ,
    I'm working over new site but one of the JS scripts in my index just won't work in Opera browser. I need an elegant method to redirect Opera users to another page.

    Any ideas ?
     
    theivo, Sep 27, 2008 IP
  2. homemadejam

    homemadejam Well-Known Member

    Messages:
    143
    Likes Received:
    2
    Best Answers:
    1
    Trophy Points:
    145
  3. iwtmmo

    iwtmmo Active Member

    Messages:
    832
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #3
    <script language="JavaScript">
    <!--
    function getOs()
    {
    var OsObject = "";
    if(navigator.userAgent.indexOf("MSIE")>0) {
    return "MSIE";
    }
    if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){
    return "Firefox";
    }
    if(isSafari=navigator.userAgent.indexOf("Safari")>0) {
    return "Safari";
    }
    if(isCamino=navigator.userAgent.indexOf("Camino")>0){
    return "Camino";
    }
    if(isMozilla=navigator.userAgent.indexOf("Gecko/")>0){
    return "Gecko";
    }

    }
    var os = getOs();
    if (os=="MSIE")
    location.href="/a.htm"
    else if ( os=="Firefox" )
    location.href="/b.htm"

    -->
    </script>
     
    iwtmmo, Sep 27, 2008 IP
  4. theivo

    theivo Well-Known Member

    Messages:
    238
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    105
    #4
    Thanks, Jam , will check this link.

    @iwtmmo : I need solution that redirects only Opera users.
    All other browsers works fine. Can i add this script to my ready index file , or have to use another page ?
     
    theivo, Sep 27, 2008 IP