简体   繁体   English

链接到打开的Facebook应用程序(如果存在),否则为网页

[英]Link to open facebook app if app exists, else webpage

I'm looking for a solution to the following. 我正在寻找以下解决方案。 We're looking to send a html mailer out next week and currently having some issues. 我们希望下周发送html邮件,目前存在一些问题。 This is the first one we've tried to do like this, and the main difference is that it now contains buttons which link to our facebook. 这是我们尝试这样做的第一个,主要区别在于它现在包含链接到我们的Facebook的按钮。

The mailer is responsive and so we are looking for a solution which will open the desktop version of the site in browser, and when viewing from a mobile, check if the app is installed and open it, and if not open the link in the browser instead. 邮件程序响应迅速,因此我们正在寻找一种解决方案,该解决方案将在浏览器中打开网站的桌面版本,并且从移动设备查看时,请检查该应用程序是否已安装并打开,如果未在浏览器中打开链接代替。

Through extensive search online and Stack Overflow I've come to realise that there is a difference between how Android and iOS allow this. 通过广泛的在线搜索和Stack Overflow,我已经意识到Android和iOS允许这样做的方式有所不同。 See below the solutions I have tried so far: 请参阅下面我到目前为止尝试过的解决方案:

 .mobile-link { display: none; } @media screen and (max-device-width: 767px) and (orientation: portrait) { .desktop-link { display: none; } .mobile-link { display: block; } } @media screen and (max-device-width: 1024px) and (orientation: landscape) { .desktop-link { display: none; } .mobile-link { display: block; } } 
 <a class='mobile-link' onclick=' setTimeout(function () { window.location = 'www.facebook.com/profileid'; }, 2500); window.location = 'fb://facewebmodal/=pagename';'> <img src='some.url' /> </a> <a class='desktop-link' href='www.facebook.com/profileid'> <img src='some.url' /> </a> 

This is not working on iPhone although my previous attempt was (I changed it to make it work for Android, which still doesn't work). 尽管我以前的尝试是这样的,但这在iPhone上不起作用(我对其进行了更改以使其可在Android上使用,但仍然无法使用)。 In my previous attempt I had : 在之前的尝试中,我有:

<a class='mobile-link' onclick='
    setTimeout(function () { window.location = 'www.facebook.com/profileid'; }, 2500);
    window.location = 'fb://profile/id';'>
        <img src='some.url' />
     </a>

Which worked for iOS but not for Android. 适用于iOS,但不适用于Android。

From what I understand facebook seems to change how users can target the app in this manner regularly. 据我了解,facebook似乎改变了用户以这种方式定期定位应用程序的方式。

Can anyone provide me with the most recent way to target both the iOS and Android app in a link of this kind please? 有人可以通过这种链接向我提供针对iOS和Android应用程序的最新方法吗?

Here are the couple of links where you can find your suitable answer: 以下是几个链接,您可以在其中找到合适的答案:

First you need to check browser is in mobile device or in desktop then apply below link code as per your requirement. 首先,您需要检查浏览器是在移动设备中还是在台式机中,然后根据需要应用以下链接代码。 here is the browser detect link : - Detecting a mobile browser 这是浏览器检测链接:- 检测移动浏览器

1) http://findnerd.com/list/view/How-to-detect-if-an-app-is-installed-in-IOS-or-ANDROID-with-the-help-of-javascript-and-Deep-Linking/4287/ 1) http://findnerd.com/list/view/How-to-detect-if-an-app-is-installed-in-IOS-or-ANDROID-with-the-help-of-javascript-and-深度链接/ 4287 /

2) How to check if an app is installed from a web-page on an iPhone? 2) 如何检查是否通过iPhone上的网页安装了应用程序?

3) iPhone browser: Checking if iPhone app is installed from browser 3) iPhone浏览器:检查是否从浏览器安装了iPhone应用程序

Let me know if you still need anything else. 让我知道您是否还有其他需要。

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

相关问题 在 Facebook 应用程序之外打开网站链接 - Open website link outside of Facebook app 如何从网站链接打开 Facebook 应用程序 - how to open facebook app from website link 使用Facebook深度URL打开应用程序时,应用程序和网页会同时打开 - When using facebook deep URL to open app, both app and webpage open together 如何通过fb://在iOS本机Facebook应用程序中将网页链接到Facebook状态 - How to link from a webpage to Facebook STATUS in iOS native Facebook app via fb:// HTML Facebook应用程序链接 - HTML Facebook App Link 如何在新窗口中打开Facebook墙上的应用程序链接? - How to open the app link on the facebook wall in a new window? 在浏览器或本机应用程序中正确打开Facebook页面链接IOS cordova - Open facebook page link in browser or native app correctly IOS cordova Is it possible to open a facebook group link in facebook app from android webview application build by android studio - Is it possible to open a facebook group link in facebook app from android webview application build by android studio 在 Facebook Messenger 应用内浏览器中检测网页 - Detect Webpage in Facebook Messenger In-app Browser 通过浏览器打开Android应用(如果已安装应用),否则打开playstore - Open Android app through browser if app is installed else open playstore
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM