0

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 (i.e. opens the Facebook group in the Facebook app), but not on Android ("Content not available").

Any idea how I can achieve this on Android?

2
  • Are you sure that group is available, and you don't need to login? normally android will ask you if you want to open the link in the facebook app, and will remember that choice. You can also start an app intent with an uri, you'll have to look in the facebook api if they support that. (source: developer.android.com/training/basics/intents/sending.html)
    – washichi
    Commented Dec 13, 2017 at 13:35
  • That's actually the issue: you'd have to log in to view the group in the browser. That's why I want the link to redirect to the app, where the user is logged in already. Commented Dec 13, 2017 at 13:58

1 Answer 1

4

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";

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.