Last post Jun 21, 2013 05:03 AM by nilsan
Member
2 Points
152 Posts
Jun 21, 2013 04:44 AM|operator|LINK
Hi. I have a website. Its view is good for laptop, desktop pcs. But in tablet, views of the pages don't stable. So, I prepare pages for tablet pcs.
How can I find a device is a tablet or not? I must redirect site according to device that is tablet or pc.
Star
11145 Points
3961 Posts
Jun 21, 2013 05:03 AM|nilsan|LINK
You may want to use 51Degrees.mobi and can download it from codeplex
The lite version allows you to detect whether incoming request is from smartphone or desktop browser.
With premium version you can detect whether incodming request is from Tablet.
However by using below code you can check whether request is from Smartphone/Tablet or Desktop browser.
if (UserAgentIs(HttpContext.Current,"ipad") || ( UserAgentIs(HttpContext.Current,"android") && !UserAgentIs(HttpContext.Current,"mobile"))) { Response.Write("Tablet"); } else if (Convert.ToBoolean(HttpContext.Current.Request.Browser["IsMobile"]) == true) { Response.Write("Mobile"); } else { Response.Write("General Request"); }
I hope it helps!
Member
2 Points
152 Posts
about redirecting site according to mobile device.
Jun 21, 2013 04:44 AM|operator|LINK
Hi. I have a website. Its view is good for laptop, desktop pcs. But in tablet, views of the pages don't stable. So, I prepare pages for tablet pcs.
How can I find a device is a tablet or not? I must redirect site according to device that is tablet or pc.
Star
11145 Points
3961 Posts
Re: about redirecting site according to mobile device.
Jun 21, 2013 05:03 AM|nilsan|LINK
You may want to use 51Degrees.mobi and can download it from codeplex
The lite version allows you to detect whether incoming request is from smartphone or desktop browser.
With premium version you can detect whether incodming request is from Tablet.
However by using below code you can check whether request is from Smartphone/Tablet or Desktop browser.
I hope it helps!
Blog | Get your forum question answered | Microsoft Community Contributor 2011