开发者

Is there anyway to open a facebook URL in the facebook app of a phone? [duplicate]

开发者 https://www.devze.com 2023-03-09 18:20 出处:网络
This question already has answers here: Closed 10 years ago. 开发者_开发问答 Possible Duplicate: launch facebook app from other app
This question already has answers here: Closed 10 years ago. 开发者_开发问答

Possible Duplicate:

launch facebook app from other app

I was wondering if there is anyway I could put a facebook link into a webpage, and, if a facebook app is installed, to get the link to facebook open in the fb app instead of the broswer?


The facebook application link starts with fb://, (according to this site), for the iPhone. So in theory clicking a link that starts with fb:// would launch the facebook app.

The problem is that the web browser application (Safari, or some custom app) decides how to handle that link, and it won't necessarily try to open another app unless it is preprogrammed to do so. If you're planning to put this on a web page, for example, and browse to it from an iPhone, there's no guarantee it will work. Better off putting two links I believe.

Not sure if the same is true for Android.


If you are showing the webpage in a Web View you can intercept the link procedure in its delegate. When a link is pressed, the message is sent to the delegate to check if the request should proceed. If you detect that it is a facebook link, you can alter it to use the fb scheme and open it with UIApplication's openURL:. To check if there is an application that can handle the fb: link you can call canOpenURL:, also of UIApplication.


Facebook applications for handheld devices aren't standard. They mostly use the API and I don't believe any application would provide you a way to open an URL.

0

精彩评论

暂无评论...
验证码 换一张
取 消