Now that you have your custom icon set up for iPhone users, here is another helpfull guide from the folks at apple to get you started on developing iPhone versions of your site. The guide has some examples on how to make content that are optimized for iPhone’s gesture-based, windowless environment.
With the iPhone accounting for larger and larger amounts of mobile browsing, despite being 2% of the smart phone market, it seems like a worth while endeavour.
But how to deliver the iPhone version too iPhone users? Browser detection, or more specifcly HTTP_USER_AGENT; this data, as well as IP address, OS, and the requested document are sent to the server.
Here is how to do this detection and content distrabution via a shell script.
Rather do it as a shell script? Me too. Here’s how I’d do that as a rudimentary Linux shell script:
#!/bin/sh
if [ ! -z "$(echo $HTTP_USER_AGENT | grep iPhone)" ] ; then
echo “Location: iphone.php”
else
echo “Location: index.php”
fi
exit 0
You can also have specific CSS information sent to diffrent user agents through if expresions.
#if expr="(${HTTP_USER_AGENT} = /iPhone/)"
iPhone styling
#else
defualt styling
#endif












Kate | March 3rd, 2008 at 5:18 am #
did you know where i can find full list of iPhone User-Agents ?
activate apple otb iphone | April 30th, 2008 at 2:00 am #
That’s good but you must have a knowledge on php in order to do that.
John Cow | July 24th, 2008 at 3:22 pm #
Yes knowledge indeed!
Web Design Zoo | August 8th, 2008 at 4:14 am #
Is this compatible with all current versions of the iphone?
iphone girl | August 28th, 2008 at 9:45 pm #
I’ve got the latest model and it worked for me.