简体   繁体   中英

In Cordova/Ionic, How to open a Facebook profile link in the native app?

I am trying to open a user's profile in the native Facebook app on ios, if installed. The app is built on Cordova/Ionic and I use ngCordova inAppBrowser plugin.

Twitter links, for example, work just fine with a regular web twitter link ( https://twitter.com/[username] ). Facebook on the other hand, do not. I have tried many different variations:

None worked.

What am I doing wrong? Is it even possible with the current version of the Facebook app?

Thanks

Just use: 'fb://profile'

In my case worked for both Android and iOS:

$scope.openFb = function() {
  $window.open('fb://profile', "_system");
};

See this answer for further reference on custom url schemes supported by Facebook iPhone app:

What are all the custom URL schemes supported by the Facebook iPhone app?

Try this:

fb://profile?id=[username|user_id]

I've tested on Safari, it works as expected,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM