基于此帖子http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-4-mobile-features显示如何识别特定视图。iPad作为非特定视图
的MVC4 indentifies通过iPad上的要求作为一个移动,但我想它识别为桌面,而不是移动,所以我用下面的代码:
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("")
{
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf("iPad", StringComparison.OrdinalIgnoreCase) >= 0)
});
有另一种更好的办法?
感谢
非常感谢格雷格,我使用样式表来识别屏幕大小,我的布局已经响应,但现在,我需要开发手机版本,我希望iPad不会被识别为移动。 – Giolvani 2013-03-14 16:14:54
我明白了,我说的是你必须确定iPad的分辨率,并将其作为焦点,因此不再被视为“移动”。上面的例子确实解决了你如何去做的问题;一些额外的细节在这里:http://stackoverflow.com/questions/8233788/how-to-avoid-loading-css-file-for-ipad-sized-devices-between-mobile-and-full – Greg 2013-03-14 16:17:30