简体   繁体   中英

can we force to open facebook link in browser not in native app iphone

Is it possible to force through your application that it will open the web link in safari only not in native app like facebook, twitter or web view etc. So far i searched found only this code that is used for opening the link

NSURL *url = [NSURL URLWithString:@"www.facebook.com"];
[[UIApplication sharedApplication] openURL:url];

But what can we paste in else there below?

if ([[UIApplication sharedApplication] canOpenURL:nsurl]){
[[UIApplication sharedApplication] openURL:nsurl];
}
else {
    //Open the url as usual, but how?
}

Use http://facebook.com/ instead of www.facebook.com this will force a link to open in Safari instead of native app*

NSURL *myURL = [NSURL URLWithString:@"http://facebook.com/"];

        if ([[UIApplication sharedApplication] canOpenURL:myURL]) {
            [[UIApplication sharedApplication] openURL:myURL];
        }

您可以使用webView打开您选择的任何链接。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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