Last post Aug 20, 2012 10:29 AM by roopeshreddy
Aug 11, 2012 12:25 AM|MagianCreative|LINK
Wondering if I am doing something wrong or if there is another solution altogether.
Here is some testing code I just wrote out:
HttpBrowserCapabilitiesBase browser = this.Context.Request.Browser;
var width = browser.ScreenPixelsWidth;
var height = browser.ScreenPixelsHeight;
var maxheight = browser.MaximumRenderedPageSize;
bool mobile = browser.IsMobileDevice;
string pageUrl = Request.Url.AbsolutePath.ToString();
if(width < 960)
I am testing on my development machine which of course is a desktop. My screen resolution is 1920 x 1200. However, my width and height variables are getting set to 640 and 480 respectively. I have tested this in IE and Chrome so far.
Aug 11, 2012 09:21 AM|BrockAllen|LINK
Some of these values aren't determined dynamically (like width/height). These values were originally developed when there was a handful of devices and they could build a server-side database with all the known dimensions of these devices. If you need to
Aug 20, 2012 10:29 AM|roopeshreddy|LINK
HttpBrowserCapabilities class won't provide you accurate browser details!!!
You may need to build your own -
Otherwise, you may have to use CSS3 Media queries -
Hope it helps u...