Detection in HTML and JavaScript is possible. No need for PHP
Here is an example for the iPhone. It looks for the "iPhone" word in the browser header. Of course you should know the other signatures from Blackberry, WindowsMobile, etc... to make it universal.
This example asks the user whether s-he wants to be redirected, but the question itself can be skipped.
Code:
<script type="text/javascript">
function iPhoneAlert() {
if((navigator.userAgent.match('iPhone'))){
var question = confirm("Would you like an iPhone optimized version of the website??")
if (question){
window.location = "http://mywebsite.com/mobile";
}else{
window.location = "http://mywebsite.com";
}
}
}
</script>
<body onLoad="iPhoneAlert();">
Bookmarks