Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • markkusq3po Friend
    #183801

    Hello,
    can somebody tell me how i can set some browser conditions?
    And perhaps provide some code if it’s directly in the index.php?
    Thanks

    TomC Moderator
    #479148

    What is it you are wanting to achieve?

    markkusq3po Friend
    #479176

    Hello Tom again,

    i want to achieve the chrome browser to take a different css file than the others. I know, normaly there are just if-conditionals for IE (maybe i’m wrong), but i found a php script which also lists chrome for some conditions:

    [PHP]<?php
    function get_user_browser()
    {
    $u_agent = $_SERVER[‘HTTP_USER_AGENT’];
    $ub = ”;
    if(preg_match(‘/MSIE/i’,$u_agent))
    {
    $ub = “ie”;
    }
    elseif(preg_match(‘/Firefox/i’,$u_agent))
    {
    $ub = “firefox”;
    }
    elseif(preg_match(‘/Safari/i’,$u_agent))
    {
    $ub = “safari”;
    }
    elseif(preg_match(‘/Chrome/i’,$u_agent))
    {
    $ub = “chrome”;
    }
    elseif(preg_match(‘/Flock/i’,$u_agent))
    {
    $ub = “flock”;
    }
    elseif(preg_match(‘/Opera/i’,$u_agent))
    {
    $ub = “opera”;
    }

    return $ub;
    }
    ?>[/PHP]

    Or is there a different way already implemented in the framework, especially the new “magic” one, to achive that?
    For this special script i tried to copy into index.php but i earned just a white screen.

    best regards
    Markus

    Ninja Lead Moderator
    #479463
Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 3 voices, and was last updated by  Ninja Lead 11 years, 10 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum