简体   繁体   中英

Open link to Facebook group in Facebook App on Android

I want to send users from my website to a group on Facebook. I do not want the group to be opened in a browser , but in the Facebook App . I am using the following Javascript:

<script>

  userAgent = navigator.userAgent || navigator.vendor || window.opera;

  if(/iPad|iPhone|iPod/.test(userAgent) && !window.MSStream) {
    window.location = "fb://profile/123456789101112";
  } else if(/android/i.test(userAgent)) {
    window.location = "fb://profile/123456789101112";
  } else {
    window.location = "https://www.facebook.com/groups/groupname";
  }

</script>

This works fine on iOS (ie opens the Facebook group in the Facebook app ), but not on Android ("Content not available").

Any idea how I can achieve this on Android?

iOS and Android links does not have the same syntax (don't ask me why...)

For iOS it's "profile" (or "group"), and for Android it's "page" if you want to send to a page, or "group" if you want to redirect to a group.

For your question, it will be like this :

window.location = "fb://group/328556620888617";

Edit : Note that for iOS, you can use this syntax :

window.location = "fb://group?id=328556620888617";

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