Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007
    Location
    England
    Posts
    495
    Tokens
    0

    Default Browser Info Help

    Hey,

    I own a site its fine for people on PC/Mac but.... When I look on it on my iTouch its wierd so I wanted my index page to find out that its an iphone/itouch and redirect to another page... but how do i make it know thats its an iphone/itouch?

    I have this code:
    PHP Code:
    <?php 
    $useragent 
    $_SERVER['HTTP_USER_AGENT']; 
    if (
    preg_match("|MSIE ([0-9].[0-9]{1,2})|",$useragent,$matched)) { 
        
    $browser_version=$matched[1]; 
        
    $browser "IE"
    } else if (
    preg_match("|Opera ([0-9].[0-9]{1,2})|",$useragent,$matched)) { 
        
    $browser_version=$matched[1]; 
        
    $browser ‘Opera’
    } else if(
    preg_match("|Firefox/([0-9\.]+)|",$useragent,$matched)) { 
            
    $browser_version=$matched[1]; 
            
    $browser "Firefox"
    } else if(
    preg_match("|Safari/([0-9\.]+)|",$useragent,$matched)) { 
            
    $browser_version=$matched[1]; 
            
    $browser "Safari"
    } else { 
            
    // browser not recognized! 
        
    $browser_version 0
        
    $browser"other"

    print 
    "browser: $browser"
    ?>
    and the iTouch safariis like this...
    Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/4A102 Safari/419.3
    Dan


  2. #2
    Join Date
    Jun 2007
    Location
    England
    Posts
    495
    Tokens
    0

    Default

    Does anyone know?

    Edited by H0BJ0B (Forum Moderator): Please do not bump your own threads.
    Last edited by H0BJ0B; 19-03-2008 at 09:04 PM.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •