REDIRECT AN IPHONE USER TO ANOTHER WEBSITE
Posted by: Søren in Technology on Aug 05, 2009
A rising interest in mobile browsing on iPhones has increased the demand for mobile optimized websites. From a business point of view there are many reasons to have an eye on this trend. The mobile generation consumer segment is rapidly rising in Europe. This trend is mainly driven by smartphones and especially Apple's iPhone (Source: Børsen). To meet this development a lot of companys need to get themselves an iPhone/mobile website - a least to make a buzz out of themselves.
Having developed my own iPhone optimized website I have been forced to take some controversial decisions. Can you force a internet browser to redirect him/her to another website automatically? Well. Depends on many things. After all I decided to give the user the opportunity to make the decision themselves - either to watch an website in an iPhone optimized version or in a full version. If you do not want to give the user this option, but just want to redirect an iPhone user directly. Well. Take a look on the scripts below:
The nerdy stuff:
A lot of websites - e.g. cover.dk has an iPhone optimized website and when the consumer point his/her browser to cover.dk they are being redirect to Cover's iPhone optimized website automatically. Smart!.
To do this you just need a simpe javascript or a simple PHP code on your website. Inset one of these codes on your Index file and your visitors will be redirected to your iPhone website automatically:
JS:
Or PHP
//setting the variables
$ipod = stripos($_SERVER['HTTP_USER_AGENT'],"iPod");
$iphone = stripos($_SERVER['HTTP_USER_AGENT'],"iPhone");
//detecting device
if ($ipod == true || $iphone == true){
header( 'Location: http://site-1/' ) ;
} else {
header( 'Location: http://site-2/' ) ;
}
?> Overall I am quite happy with the result.
Check it out for yourself on cover.dk or www.vw.com.

written by Søren Ørnholt Jørgensen , August 07, 2009
written by Søren Ørnholt Jørgensen , August 22, 2009
written by Søren Ø , June 27, 2010
http://www.htaccesstools.com/articles/detect-and-redirect-iphone/
Cheers
written by iPhone Repair Houston , March 26, 2011
written by Homemade windmill Power , March 27, 2011