Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9193409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:09:21+00:00 2026-06-17T21:09:21+00:00

Is there a way to detect what browser you are using through template toolkit?

  • 0

Is there a way to detect what browser you are using through template toolkit? For example I can achieve what I want to do using jQuery but thought it would be useful to know how to do it in template toolkit if possible?

Jquery

    <script>
    jQuery(window).load(function(){
        if ( (jQuery.browser.msie && jQuery.browser.version < 9.0) )
        {
            jQuery('body').addClass('old-ie');
        }
    });
    </script>

In template toolkit I want to do something like the below but can’t see this in the documentation anywhere?

    <body 
    [% IF browser.msie && browser.version < 9.0 %]
    class="old-ie"
    [% ELSE %]
    [% END %]
    >
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:09:22+00:00Added an answer on June 17, 2026 at 9:09 pm

    I’m not aware of a TT plug-in for this, but it’s trivial to add a line or two to your back-end application to make the information available to the template. For example, if your app is Catalyst based, you would add something like this to your main program:

    __PACKAGE__->apply_request_class_roles(qw/
        Catalyst::TraitFor::Request::BrowserDetect
    /);
    

    … and in your ‘auto’ handler, introduce a line such as (untested):

    $c->stash(browser => $c->req->browser);
    

    … or just use this is your template:

    [%- SET browser = c.req.browser;
        SET old_ie = 'class="old-ie"'
            IF browser.windows && browser.ie && browser.public_major < 9.0;
    -%]
    

    and then include old_ie wherever it’s required in your template.

    See Catalyst::TraitFor::Request::BrowserDetect and HTTP::BrowserDetect for more info and options. I’m sure there are similar plugins/methods for Dancer, Mojolicious etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way that I can detect browser type on routing and use
Is there a way with JQUERY or Javascript, to detect anytime the browser window
Is there a jquery way or plugin to detect the visitor's browser window size
Normally, i'm using Modernizr for regular feature detection but it can't detect browser selector
Is there a way to detect if a browser window is closed using GWT.
Is there any way to detect if a commercial is playing? I'm using player.observe(models.EVENT.CHANGE,
I am curious if there is a way to detect the browser refresh event
Is there a way to detect if javascript is executing a script using either
I need a quick and dirty way to detect media query support using jquery.
Is there a good way to detect if the user's browser is Internet Explorer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.