I have a web app using the Facebook javascript SDK. I want to detect if this web app is running within the native Facebook app on iOS or Android. The reason is because if not running within a proper browser I want to open certain links in a floating iframe instead of a new web page/tab.
How can I easily detect if running on mobile within the native Facebook app. I am aware of the answer that suggests using FB.UA but that answer is 3 years old and that API is not documented anymore.
OR
Is it possible specify an HREF to launch a URL in the native browser on a mobile device? Then my links could launch a browser and my web app keeps running within the Facebook native app.
Our in-app browser for Facebook on Android has historically relied on an Android System WebView based on Chromium, the open source project that powers many browsers on Android and other operating systems.
Your website can check if your PWA is installed, even if the page is outside the scope of your PWA. For example, a landing page served from /landing/ can check if the PWA served from /pwa/ is installed, or if your landing page is served from www.example.com and your PWA is served from app.example.com .
The closest that you can do is in the application, have an activity that has an <intent-filter> for some URL structure, and have a link in the mobile Web site to a matching URL. If the user clicks the link and the app is installed, the activity will be a chooser option for the user.
This works fine for me in JavaScript:
if (navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/FBAV/i)) {
//iOS Facebook App Browser detected
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With