Last post Aug 27, 2010 04:08 PM by rajsedhain
Aug 26, 2010 07:03 PM|rajsedhain|LINK
Last week Android updated their software (changed the display from 480px to 800px) so all the mobile tweaks we made for our apps are no longer work on Droid Phones.
I would need to identify the User Agent(e.g. Android) and switch style sheets depending. (We don't want to redirect to another page, just switch style sheets).
Anybody know any lightweight solution ?
Thanks in Advance.
(we were using 480px pixels to identify if the user was coming from iPhone or Android and switched stylesheets accordingly. If I changed it to 800px some desktop monitors and the iPad would see the mobile version and not the desktop version. Not good.)
Aug 26, 2010 07:23 PM|Evan Freeman|LINK
Let me elaborate:
include android CSS here
include iPhone css here
Aug 26, 2010 09:14 PM|rajsedhain|LINK
Thanks Evan for your reply.
Android changed the display 480px to 800 px. I was using 480px pixels to identify if the user was coming from iPhone or Android and switched stylesheets accordingly.
So, can I just neglect that pixels thing to identify the device and follow your suggestion ?
Aug 27, 2010 01:46 PM|amar_j|LINK
The latest capabilities list which is available in WURFL is read using 51degrees.mobi Foundation API which detects all mobile devices. It is a .NET open source available here
It easily detects if the request is coming from any mobile device and redirects user to mobile landing page. It has some user friendly samples to try out.
There is a 4 minute video which shows how to Enhance your existing website to contain mobile pages.
Video (3:43 minutes): http://www.youtube.com/watch?v=b4io5KB4Qt0
Hope this helps
- Thank You
Aug 27, 2010 04:08 PM|rajsedhain|LINK
This code solved my problem. Thanks to all.
//for Mobile device
protected override void OnInit(EventArgs e)
string userAgent = Request.UserAgent;
|| (userAgent.Contains("iPhone") || (userAgent.Contains("Android"))))
//add css ref to header from code behind
HtmlLink css = new HtmlLink();
css.Href = ResolveClientUrl("~/mobile.css");
css.Attributes["rel"] = "stylesheet";
css.Attributes["type"] = "text/css";
css.Attributes["media"] = "all";