简体   繁体   English

链接以在Android或iOS上启动Facebook或Google+应用

[英]Link to start Facebook or Google+ app on Android or iOS

There are very similar questions on the board but I still didn't find satisfying results for my topic. 董事会上也有非常相似的问题,但是我仍然没有找到令人满意的结果。

I have to implement links on our website to redirect to Facebook and Google+ for check-ins to my company. 我必须在我们的网站上实现链接以重定向到Facebook和Google+,才能签到我的公司。 It should be possible to click on the link on the website and my smartphone (Android) should ask if this link should open for example the Facebook App or the Link to the Site in the Smartphone browser. 应该可以单击网站上的链接,而我的智能手机(Android)应该询问该链接是否应该打开,例如,Facebook应用程序或智能手机浏览器中的“网站链接”。

Is there a link that the smartphone can parse: -the app is installed, would you like to open the G+ or Facebook app -or open the web-browser from the smartphone 智能手机可以解析一个链接吗?-该应用已安装,您想打开G +或Facebook应用-还是从智能手机打开网络浏览器

The link should also redirect me on the Facebook/G+ site of my company. 该链接还应该在我公司的Facebook / G +网站上重定向我。 So after the user chooses the app or web browser he/she should be able to check-in with one click. 因此,在用户选择应用或网络浏览器之后,他/她应该能够一键签到。

I think there are already standards for links like this. 我认为这样的链接已经有了标准。 I just can't find any satisfying results for my problem. 对于我的问题,我找不到任何令人满意的结果。

I am currently testing with Android but it would be cool if the links would be also working with iOS :-) 我目前正在使用Android进行测试,但是如果链接也可以在iOS上运行,那将很酷:-)

This would be a similar question. 将是一个类似的问题。

I added this html snippet to my page: href="fb://page/77664937087" 我将此HTML代码段添加到了我的页面中: href =“ fb:// page / 77664937087”

The problem is I have to parse if the user has installed the app or the browser. 问题是我必须分析用户是否已安装应用程序或浏览器。 In this case the app would open. 在这种情况下,应用程序将打开。 But I need some sort of if-statement. 但是我需要某种if语句。 I am no javascript pro so I need some help for this. 我不是javascript专业人士,因此我需要一些帮助。

And I don't want to implement 2 seperate links for app or browser. 而且我不想为应用程序或浏览器实现2个单独的链接。

You can use this method of UIApplication to check whether the app is installed: 您可以使用UIApplication的此方法来检查应用程序是否已安装:

- (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS(3_0);

If can not you can open the url using following code: 如果不能,则可以使用以下代码打开网址:

NSString *url = @"xxxxxx"; //your link here
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

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

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