iOS Facebook app browser detection

The original iOS Facebook app seems to have its own “browser”. If the user clicks on a link in facebook, the URL is not opened in safari or any other standard browser but the Facebook app uses its own browser – which seems to have its problems with some media tags, especially “orientation”. At least it can be pretty easily identified via HTTP_USER_AGENT:

if(preg_match('/FBIOS/i',$_SERVER['HTTP_USER_AGENT']){
    //facebook browser
    if(preg_match('/iPad/i',$_SERVER['HTTP_USER_AGENT'])){
        //facebook browser via ipad
        echo "iPad!";
    }else{
        //facebook browser via iphone
        echo "iPhone!";
    }
}

for fucks sake, I HATE iOS.

BTW HTTP_USER_AGENT returns the following on ipad:

Mozilla/5.0 (iPad; CPU OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11A465 [FBAN/FBIOS;FBAV/6.5.1;FBBV/377040;FBDV/iPad3,6;FBMD/iPad;FBSN/iPhone OS;FBSV/7.0;FBSS/2; FBCR/;FBID/tablet;FBLC/de_DE;FBOP/1]

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.