views:

139

answers:

2

I just found the IUI project on google code where you can build websites that look like iPhone apps.

I have an asp.net MVC website already built. When a user clicks on my website from an iPhone, i want to redirect them to another page that is targeted to the iPhone.

how can i do this detection and redirection?

+1  A: 

Check for the User Agent. ie the javascript way.

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
     if (document.cookie.indexOf("iphone_redirect=false") == -1) window.location = "http://m.url.com";

}

Or do it in .net with something like Mobile Device Browser File.

John Wang
A: 

Use http://51degrees.codeplex.com . It makes use of WURFL mobile device database to detect mobile devices and providing auto redirection to mobile optimized pages.

Amit Patel