ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Browser check with conditional processing

July 25, 2011 5:22pm

Subscribe [2]
  • #1 / Jul 25, 2011 5:22pm

    Glen Coulthard

    16 posts

    Hi there,

    I am trying to use a conditional in order to include an image based on the browser version.

    I downloaded a plug_in called Which_browser, but it isn’t working for me inside an IF construct. The which_browser tag by itself, however, returns the appropriate browser code (e.g., Firefox or IE9). Here is the code that I’m trying in my template.

    {if exp:which_browser=="IE6" OR exp:which_browser=="IE5"}
       blah.gif
    {if:else}
       blah.png
    {/if}

    Since this isn’t working, I would appreciate any suggestions or alternatives?
    Thanks for any assistance,
    Glen

  • #2 / Jul 25, 2011 8:11pm

    the3mus1can

    426 posts

    Try this:

    {if "{exp:which_browser}" =="IE6" OR "{exp:which_browser}" =="IE5"}
       blah.gif
    {if:else}
       blah.png
    {/if}

    The quotes are probably not needed, but it safer that way.

  • #3 / Jul 25, 2011 8:29pm

    Glen Coulthard

    16 posts

    Brilliant! Thank you very much—worked perfectly.—Glen

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases