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
Author comments are in a darker gray color for you to easily identify the posts author in the comments
Comments are closed since this post is older than 30 days. However, you can continue this discussion in our popular Blogging Forums
did you know where i can find full list of iPhone User-Agents ?
That’s good but you must have a knowledge on php in order to do that.
Yes knowledge indeed!
Is this compatible with all current versions of the iphone?
I’ve got the latest model and it worked for me.