Open link to facebook in iOS Safari

Asked

Viewed 2,410 times

1

Setting:

  • I own an app, which has a link to a particular page on facebook.
  • When the user clicks on the link, it should be directed to the page and load it with Safari.
  • But if you have the Facebook App installed on your iPhone, iOS directs the link to the App and the Facebook App doesn’t show the page.

    Would anyone know how to determine that a link must be opened in Safari, not the Facebook App?

    Code used: Objective-C.

  • Are you wearing a UIWebView?

  • No. Somente um link na action:

´ - (IBAction)linkFacebook:(id)sender {
 
 [[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"https://www.facebook.com/********"]];
}´

  • I think I found a solution, I’ll do some tests and as it is I’ll report here.

  • Well the solution I tried was to remove "http://www." from Urk and only facebook.com/*****. But it didn’t work.

  • 1

    Take a look in that issue from the OR, I think it might help.

2 answers

2


As @Paulorodrigues suggested me on the link>

Just add "?ref=0" at the end of the URL.

Being:

 www.facebook.com.br/PAGINA

Staying

www.facebook.com.br/PAGINA?ref=0

This forces the link to open in iOS Safari.

  • Funny that both in the commentary up there and here you called me Paulo Roberto :)

  • True,.. I’m sorry... Kkkkkk this Paulo Roberto is a friend... Ai was in the automatico... Correcting!

  • Another way you can also use for this is by putting "http://"

  • Gian, even with "http://", and without "http://" does not open safari or the facebook app... just nothing happens :D

  • Strange, here for me to open in safari I use http:// and fixed my problem...

  • But you have the Facebook app installed on iPhone? Because I tested on 4S and 6 and always opened the app.

Show 1 more comment

1

Try using this method. Just put deepLink if you want the app to open the facebook app, or open Safari with the given url.

Example of a deep link (appURL): fb://page/id_pagina

Example of a URL: https://www.facebook.com/something

+ (void)openSocialNetworkURLWith:(NSString *)appURL URL:(NSString *)url {

    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:appURL]]) {

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:appURL]];

    } else {

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.