Okay, either people don’t know about this, or it’s being distributed in other ways.
The team that runs the web servers for Microsoft has compiled a list of nearly every available mobile device type that has requested a page from its servers (using services like Live, Hotmail, etc). The compilation includes an incredible set of over five dozen properties exposed about the mobile browser used on that device.
If you write applications for mobile devices, you need to be using this! Because each device might be in horizontal or vertical mode, because the screen sizes vary, because different devices can playback different kinds of media, because some mobile devices might support AJAX…because of a whole host of things, if you are writing web applications for mobile devices using ASP.Net you really need to get plugged in here.
Here’s the project site on CodePlex: Mobile Device Browser File
Now, what gets me is that there are so few downloads. Even the one that’s been around longest has not even 700 downloads!
What’s so beautiful about this nonsense I’m going on about? Well, check this out:
Simply by dropping the mobile.browser file in a folder in your project you gain instant capabilities detection from the existing framework, without a line of code. Except, of course, to check the capabilities.
How easy is this:
if (Request.Browser.IsMobileDevice)
{
if (int.Parse(Request.Browser["ScreenPixelsWidth"]) > 240)
Label1.Font.Size = 40;
else
Label1.Font.Size = 20;
}
Now, you are likely to do something more interesting, like serving up appropriate image types for the devices.
Either way, when you pair this with ASP.Net MVC you start to get some very interesting things going on, as Scott Hanselman wites.
I just can’t believe more people aren’t developing in the mobile space…or don’t care to leverage this powerful resource!
No comments:
Post a Comment