MVC 4 not redirecting to mobile for Android v4+?

I am finding certain devices are not being redirected to the .Mobile.cshtml counterpart automatically. Is there a way to fix this or force mobile based on screen resolution via HttpContext.GetOverriddenBrowser method?

Answers


You could try to add a little piece of Javascript to create a cookie with Javascript's

 window.screen.availHeight
 window.screen.availWidth

and then on the server side inspect the cookie in the _PageStart.cshtml (which runs before each page is returned) and and if it meets your requirements override with

HttpContext.SetOverriddenBrowser(BrowserOverride.Mobile)

Need Your Help

How does this simple FxAA work?

opengl graphics opengl-es shader

I came across this FxAA shader that does anti-aliasing and seems to be working quite well.