Reputation: 3011
Usually Majority of IE sends this useragent
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8)
but some IE sends this Useragent
Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Tablet PC 2.0; .NET4.0C; .NET4.0E; MS-RTC LM 8)
I have 2 layouts, application.html.haml & application.mobile.haml
As the second one includes "Tablet PC 2.0" Mobile-Fu sets the format to :tablet which not rendering the layout in my rails App.
Kindly help me in fixing this Issue. Thanks!
Upvotes: 1
Views: 317
Reputation: 3011
Temporarily i fixed by changing the user agent if request is from IE & includes Tablet PC,
class ApplicationController < ActionController::Base
before_filter :change_user_agent_for_ie
def change_user_agent_for_ie
if request.env["HTTP_USER_AGENT"].include?("Tablet PC 2.0") && (request.env["HTTP_USER_AGENT"].include?("MSIE"))
request.env["HTTP_USER_AGENT"] = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; MS-RTC LM 8)"
end
end
Not sure what will the permanent fix for this.
Upvotes: 0