to detect the users coming from iphone/ipod and then act accordingly.
the code can be altered to detect any other browser too.
js
<script language=javascript>
<!--
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)))
{
location.replace("iphone-version.html");
}
-->
</script>
php
<?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/' ) ;
}
?>
Set as favorite
Bookmark
Email This
Hits: 525
Comments (0)










