【问题标题】:Using a URL to launch a Facebook app fan page on mobile platforms?使用 URL 在移动平台上启动 Facebook 应用粉丝页面?
【发布时间】:2011-10-24 03:34:20
【问题描述】:

我花了一些时间研究这个问题,但找不到答案。

基本上,我正在尝试使用 fb:// 句柄编写一个 URL,它将在智能手机的 Facebook 应用程序上打开我的 Facebook 粉丝页面。

下面的页面提供了 FB 应用程序支持的句柄代码列表,但我不知道如何让它启动到我的页面: What are all the custom URL schemes supported by the Facebook iPhone app?

我了解到我的页面 ID 是:212971392077465

最终,我希望我正在编写的网页检查是否安装了 Facebook 应用程序,如果安装了,则将其启动到粉丝页面,但如果没有,则重定向到 http://m.facebook.com 上的粉丝页面。

我想这样做而不是直接访问 Facebook 的移动网站,因为如果该应用程序安装在用户的手机上,那么他们可能无法通过浏览器在 Facebook 上进行身份验证,这会降低体验的便利性。

然后,我想将其集成到二维码中,以便于智能手机访问,以便人们以最快、最简单的方式“点赞”该页面。

非常感谢您的建议!

【问题讨论】:

    标签: facebook url


    【解决方案1】:

    我也有同样的问题。这将起作用:

    <a href="fb://profile/212971392077465" class="facebook">My Fanpage</a>
    

    当我读到这篇文章时,我想出了这个主意:

    String uri = "fb://profile/" + yourFBpageId; 
    Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));   
    
    // Add try and catch because the scheme could be changed in an update! 
    // Another reason is that the Facebook-App is not installed 
    try {      startActivity(intent);   
    } catch (ActivityNotFoundException ex) {      
    // start web browser and the facebook mobile page as fallback    
    String uriMobile = "http://touch.facebook.com/pages/x/" + yourFBpageId;    
    Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uriMobile));    
    startActivity(i); 
    }
    

    上面的代码可以很好地在网页 URL 中反转:如果用户没有在智能手机上安装 Facebook 应用程序,touch.facebookm.facebook 将被启动。

    也许可以用 PHP 来完成。

    【讨论】:

    • 你在那个(java?)代码中使用了哪些库?是 facebook 的库还是 android 的库? (例如,我指的是意图)谢谢
    【解决方案2】:

    您需要为您的页面创建一个唯一的用户名,然后您将获得一个类似 facebook.com/yourpageusername 的网址

    因此,当通过手机访问时,请尝试使用 m.facebook.com/yourpageusername

    这将是您的直接移动粉丝页面链接。

    如果您想通过手机查看桌面版 facebook,比如 iPhone(通常如果您从移动设备访问 facebook.com,facebook 本身会重定向到 m.facebook.com 或 touch.facebook.com移动网站)

    试试:www.facebook.com/?m2w

    这将通过您的移动浏览器强制显示桌面版本。

    希望对你有帮助!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-30
      • 1970-01-01
      • 2013-04-26
      • 2011-04-03
      相关资源
      最近更新 更多