Skip to content

Instantly share code, notes, and snippets.

@gabrieljoelc
Created October 31, 2012 19:20
Show Gist options
  • Save gabrieljoelc/3989232 to your computer and use it in GitHub Desktop.
Save gabrieljoelc/3989232 to your computer and use it in GitHub Desktop.
ASP.NET MVC 4 DisplayMode Example
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)
});
}
}
<h1>I'm an iPhone view!</h1>
<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