7

I'm succesfully using Facebook share method on my webapp like so using the FB JS SDK.

FB.ui({
   method: 'share',
   href: 'https://myapp.com',
})

However if a user access my webapp using mobile device it requires them to login to facebook through browser even if they have the main facebook app installed on the device. Is it possible to launch share dialog using native facebook app with intent if available and if not fallback to facebook in browser to share.

jasan
  • 11,475
  • 22
  • 57
  • 97

2 Answers2

0

Facebook has url schemes which have worked in the past on iOS; I don't have a device to test on, but I suspect some of them likely still work.

Similar schemes exist for Android, and just like on iOS, they seem to become disabled and replaced with other tricks / techniques on occasion.

In Javascript, you can check the OS name. I would check for Android or iOS, and then attempt to trigger a url scheme for whichever you find, if either.

Max von Hippel
  • 2,856
  • 3
  • 29
  • 46
0

in addition to above answer, chrome 61 onwards you can use share api. This will work same as android intents, with all possible user-installed-native-apps showing in tray, including facebook.

navigator.share({
 title,
 url,
})
Shishir Arora
  • 5,521
  • 4
  • 30
  • 35