Detect request is from iPad in ASP.NET

iPad. People slowly liking it. Few days ago, I have written a post on how to detect the request is from the iPhone. So, as iPad applications are also growing day to day, I want to give you a small tip on how to detect requests are from iPad. So that you will write logic which is specific to the iPad like html, CSS, scripts etc.

Detect request from iPad in ASP.NET [C#]:
if(HttpContext.Current.Request.UserAgent.ToLower().Contains("ipad"))
{
     //iPad is the requested client. Write logic here which is specific to iPad.
}
else
{
     //Normal browsers [from computers] requested.
}

Detect the iPad request in Java script:
if (navigator.userAgent.match(/iPad/i)

Very simple, isn't it. Hope this helps.

0 komentar:

Post a Comment

Related Posts with Thumbnails
GiF Pictures, Images and Photos