How to detect Facebook in-app browser?
You can check for FBAN / FBAV in the user agent.
Check this link: Facebook user agent
You can use https://www.npmjs.com/package/detect-inapp and check if inapp.isInApp() is true
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);
}