使用URL在移动平台上启动Facebook应用程序粉丝页面?

Ben*_*Ben 9 url facebook

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

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

下面的页面给出了FB应用程序支持的句柄代码列表,但我无法弄清楚如何将其启动到我的页面: Facebook iPhone应用程序支持的所有自定义URL方案是什么?

我知道我的网页ID是:212971392077465

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

我想这样做而不是直接到Facebook的移动网站,因为如果应用程序安装在用户的手机上,那么它们可能不会通过浏览器在Facebook上进行身份验证,这会使体验变得不那么方便.

然后,我想将其集成到QR码中,以便更轻松地访问智能手机,因此人们可以以最快捷,最简单的方式"喜欢"页面.

非常感谢任何建议!

本

小智 16

我有完全相同的问题.这将有效:

<a href="fb://profile/212971392077465" class="facebook">My Fanpage</a>
Run Code Online (Sandbox Code Playgroud)

我读到这个时想出了这个想法:

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); 
}
Run Code Online (Sandbox Code Playgroud)

如果用户没有在智能手机上安装Facebook应用程序,touch.facebook或者m.facebook将启动,则上面的代码可以在网址中反转.

也许可以用PHP完成.