Jump to:

23483 Posts in 18976 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » [SOLVED] User Agent Detection

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 2310 Views
  • steve_nyhof
    Community Member
    224 Posts

    Re: [SOLVED] User Agent Detection Link to this post

    I ended up using a lightbox to create a popup - but this also worked to find the browser..
    See this thread for more options...

    Add to the Page.php below the class
    class Page_Controller extends ContentController {

    function get_user_browser()
    $u_agent = $_SERVER['HTTP_USER_AGENT'];
    $ub = '';
    $ub = "ie";

    return $ub;

    Then in the template...

    <% if get_user_browser == ie %>
    Do something for IE
    <% else %>
    Else do something for all others
    <% end_if %>

    Hope this helps someone

Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.