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
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
You can check for FBAN / FBAV in the user agent.
Check this link: Facebook user agent
var us = navigator.userAgent
gives you a string value. .indexOf()
checks for the position of a sub-string in a string. If it is not found a value of -1 is returned. It is simply checking if it is the Facebook browser, by checking if the browser's user agent contains either of the given sub strings.
Dec 11, 2016 at 7:27
(ua.indexOf('Instagram') > -1)
Oct 2, 2018 at 23:43
|| window.opera
bit? I don't think it would cast to the user agent string.
Oct 15, 2020 at 7:27
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);
}
You can use https://www.npmjs.com/package/detect-inapp and check if inapp.isInApp() is true