Shawn Lindsey

Rails (IE) Internet Explorer 6.0 Detection

It is well know that there are many issues with IE 6 displaying HTML properly.

To detect IE 6 in a Rails view use the following code:

<% if request.env['HTTP_USER_AGENT'] =~ /MSIE 6/ %>
Do what you need if IE6
<% else %>
Do this if "normal" broswer"
<% end %>

To check for other browsers just alter the regular expression match "=~ /..../"

 

Shawn Lindsey

Categories

Other Posts

RSS Feed

Subscribe

Archives