How to detect Facebook in-app browser?

JavascriptFacebookMobileBrowserIn App

Javascript Problem Overview


Have you had any experience in Facebook in-app browser detection? What's the core difference in user agent?

I don't want to know if it is a only mobile/ios/chrome. I need to know whether user agent is specific from Facebook in-app browser

Javascript Solutions


Solution 1 - Javascript

You can check for FBAN / FBAV in the user agent.

Check this link: Facebook user agent

Solution 2 - Javascript

To complete worker11811's answer on using the user agent, here's a code snippet to make it work:

function isFacebookApp() {
    var ua = navigator.userAgent || navigator.vendor || window.opera;
    return (ua.indexOf("FBAN") > -1) || (ua.indexOf("FBAV") > -1);
}

Solution 3 - Javascript

You can use https://www.npmjs.com/package/detect-inapp and check if inapp.isInApp() is true

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionmilosz0010View Question on Stackoverflow
Solution 1 - JavascriptJan SwartView Answer on Stackoverflow
Solution 2 - JavascriptSascha KlattView Answer on Stackoverflow
Solution 3 - JavascriptDonnaTellooView Answer on Stackoverflow