Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post

    PLEASE HELP! Detect safari browser with php GOING INSANE! ><

    Can someone please tell me how I can fix this so it detects ONLY the string "Safari" from within the user agent string
    and not "Safari/REPLACE THIS PART OF THE STRING WITH THE VERSION HERE"?

    PHP Code:
    <?php
    function is_safari(){
    if(
    strstr($_SERVER['HTTP_USER_AGENT'], "Safari")){
    return 
    true;
    }else{
    return 
    false;
    }
    }
    if(! 
    is_safari()){
    echo 
    "<td>\r\n";
    }else{
    echo 
    "hello!\r\n";
    }
    ?>

  • #2
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    have you tried using the get_browser() function?
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #3
    Regular Coder
    Join Date
    Apr 2009
    Posts
    264
    Thanks
    24
    Thanked 1 Time in 1 Post
    Nvm, solved


  •  

    Posting Permissions

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