简体   繁体   English

在Android上的Facebook App中打开指向Facebook组的链接

[英]Open link to Facebook group in Facebook App on Android

I want to send users from my website to a group on Facebook. 我想从我的网站用户发送到在Facebook上。 I do not want the group to be opened in a browser , but in the Facebook App . 希望在浏览器中打开该组, 而是在Facebook App中打开该组。 I am using the following Javascript: 我正在使用以下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"). 这在iOS上正常运行(即在Facebook应用程序中打开Facebook组),但在Android上则无效 (“内容不可用”)。

Any idea how I can achieve this on Android? 知道如何在Android上实现这一目标吗?

iOS and Android links does not have the same syntax (don't ask me why...) iOS和Android链接的语法不同(不要问我为什么...)

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. 对于iOS,它是“配置文件”(或“组”),对于Android,它是“页面”(如果要发送到页面),或“组”(如果要重定向到一个组)。

For your question, it will be like this : 对于您的问题,它将是这样的:

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

Edit : Note that for iOS, you can use this syntax : 编辑:请注意,对于iOS,可以使用以下语法:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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