Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect Facebook Mobile Browser

Is it somehow possible to detect Facebook's mobiles apps' browser via PHP or JS? My apps all have problems inside their browser (in native browser not!) and I want to show a warning notice.

Alternatively, is there a possibility to directly open the website in a external browser?

like image 866
Moskau Peterson Avatar asked Feb 16 '26 06:02

Moskau Peterson


1 Answers

This works fine for me in JavaScript:

if (navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/FBAV/i)) {
    //iOS Facebook App Browser detected
}

More information about the User Agent: Is this a Facebook for iOS WebView User Agent?

Afaik it´s not possible to force the website to open in any external browser, only the user can do that.

like image 66
andyrandy Avatar answered Feb 17 '26 19:02

andyrandy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!