如何安装时只能从网址打开Facebook应用程序 [英] how to open Facebook app from url only if installed

查看:110
本文介绍了如何安装时只能从网址打开Facebook应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我不想在浏览器中打开该页面,我想知道如何在Facebook和twitter应用程序中打开我的网站的URL链接。

I would like to know how to open up a url link from my website in the facebook and twitter app only if it is installed on the device, if not I would like the page to be opened in the browser.

目前我使用以下链接:

fb://profile/fbID
twitter://user?screen_name=username

目前,已安装但链接失败,如果该应用程序未安装,进一步如此,如果您尝试在桌面浏览器中打开它,这个twitter链接将完全失败。

Currently it works fine if the app is installed but the link fails if the app isn't installed, further to this the twitter link fails completely if you try to open it in a desktop browser.

知道我该怎么做?

是的,我知道有类似的问题,但没有一个回答,所以我以为我会尝试这个,欢呼。

Yes I know there are similar questions but none have been answered so I thought I'd try this, cheers.

推荐答案

您可以尝试将手机重定向到打开应用程序,如果没有发生任何事情,请将其重定向到所需的网页。

You can try redirecting the phone to opening the app, and if nothing happens, redirect it to the web page you want.

setTimeout(function () { window.location = "https://itunes.apple.com/appdir"; }, 25);
window.location = "appname://";

如果第二行代码工作,那么第一行将不会执行。

If the second line of code works, then the first won't be executed.

这篇关于如何安装时只能从网址打开Facebook应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆