Like the basic browser detection you can easily detect ipad in your website using PHP script.This is very useful in developing ipad specific web applications.
The PHP script uses the $_SERVER[‘HTTP_USER_AGENT’].
<?php echo($_SERVER[‘HTTP_USER_AGENT’]); ?>
A simple script to detect ipad and redirect to a page.
< ?php if(strstr($_SERVER['HTTP_USER_AGENT'],’iPad’)) { header(‘Location: http://www.devlup.com/ipad’); } ?>
Similarly iphone can be detected using the same way
< ?php if(strstr($_SERVER['HTTP_USER_AGENT'],’iPod’)) { header(‘Location: http://www.devlup.com/iphone’); } ?>
Developer’s Link:
Try this script on your ipad and share your views.
nice to know, and very helpful.
Is it possible to do applications with PHP that works or can be run on iphones or iPad?
hi victor,
You can build iphone and ipads applications without knowing objective C.
U can build apps just with html and java script too. there are many frameworks in the market that help u do so.
Ex,
appcelerator,
Phonegap,
Buildanapp…. etc
I am doing a news website using PHP & Mysql can this script run it in Iphone & Ipad
you can use this script to detect the users using iphone and ipad to visit your page
Hello Jeyaganesh,
I have tried your ipad php detection code – with no luck
I have 2 questions.
1. What do you call the php file – eg index.php ?
2. Where do you put the php file on your server – eg /public_html ?
Thanks
Hello michael
index.php is the default page of the website it will be in the www root.
The script which I mentioned here is to detect whether the user is using an ipad/iphone to view the site..
you can reply,if you still need clarification about it.
Thanks
If it’s not working it’s probably because this entry was made using an apple instrument so what should be ‘iPad’ becomes ’iPad’ which translates to something like iPad on Unix.
My advice: don’t use apples.
They’re far too expensive anyways.