ana
2/23/2015 - 5:43 PM

How to do conditional code for IE using Twig

How to do conditional code for IE using Twig

{% set user_agent = app.request.server.get('HTTP_USER_AGENT') %}

{% if 'MSIE 10' in user_agent or 'MSIE 9' in user_agent or 'MSIE 8' in user_agent %}
    IE code  
{% else %}
    Other browser's code 
{% endif %}