Created
October 31, 2012 19:20
-
-
Save gabrieljoelc/3989232 to your computer and use it in GitHub Desktop.
ASP.NET MVC 4 DisplayMode Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MvcApp : System.Web.HttpApplication { | |
protected void Application_Start() { | |
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("iPhone") | |
{ | |
ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf | |
("iPhone", StringComparison.OrdinalIgnoreCase) >= 0) | |
}); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>I'm an iPhone view!</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>I'm a mobile view!</h1> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment