Reputation: 1001
I created the layout for mobile devices - _Layout.Mobile.cshtml there own scripts, their styles, all okay, on tablets computers loaded full version of the website (_Layout.cshtml).
On mobile phones loaded mobile version (_Layout.Mobile.cshtml)
BUT iPads (though he refers to the tablet PC) is loaded mobile version
how can I fix it?
Upvotes: 2
Views: 1758
Reputation: 168
From my knowledge, you need to tell the DisplayModeProvider that iPads should get the default display mode (the desktop view).
This can be achieved with the following code:
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode()
{
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf("iPad", StringComparison.OrdinalIgnoreCase) >= 0)
});
The code is fairly explanatory, you insert a mode that is the default with the context of iPad being in the user agent.
See more here: http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-4-mobile-features under "Browser-Specific Views"
This should go in the Application_Start() method of your Global.asax.cs
Upvotes: 6