?
Solved

detect iphone browser

Posted on 2011-05-02
3
Medium Priority
?
251 Views
Last Modified: 2012-05-11
$browser = $_SERVER['HTTP_USER_AGENT'];

what is iphone broswer

how can I do an
if iphone browser
then
do something
0
Comment
Question by:rgb192
  • 2
3 Comments
 
LVL 13

Accepted Solution

by:
jonahzona earned 2000 total points
ID: 35508119
<?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/' ) ;
}
?>

Open in new window


This will detect iphone or ipod browser then redirect the page.
0
 
LVL 13

Expert Comment

by:jonahzona
ID: 35508140
Change the page you want it to go after the LOCATION:
0
 

Author Closing Comment

by:rgb192
ID: 35514264
Thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month14 days, 22 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question