开发者

A facebook link not opening on iphone

开发者 https://www.devze.com 2023-04-07 16:51 出处:网络
I want to open a facebook comment page link Like http://www.facebook.com/comments.php?href=http://wombeta.jiffysoftware.com/ViewWOMPrint.aspx?WPID=310

I want to open a facebook comment page link Like

http://www.facebook.com/comments.php?href=http://wombeta.jiffysoftware.com/ViewWOMPrint.aspx?WPID=310

but problem is this link doesnot open in iphone device or simulator but opens fine on desktop.When i try to open this link on simulator it opens the m.facebook site then shows error "Could not find the page" Please tell me a way to open this link in iphone

My code is simple:

NSURL *url = [NSURL URLWithString:@"http://www.facebook.com/comments.php?href=http://wombeta.jiffysoftware.com/ViewWOMPrint.aspx?WPID=317"];

    NSURLRequest *requestObject = [NSURLRequest r开发者_高级运维equestWithURL:url];
    [webView loadRequest:requestObject];


response of any url from FB server (like many other servers) is based on the "user agent" whenever a web call is made, the device automatically attach user agent with request. In your case the "user agent" is being sent by devices is the one of mobile Safari - Native iphone Safari app so the server is returning with mobile site response with m.facebook......

you need to find a mobile site equivalent link for the same and I'm pretty sure that FB will have it in some way or the other.

Best of Luck!


[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://www.facebook.com/comments.php?href=http://wombeta.jiffysoftware.com/ViewWOMPrint.aspx?WPID=317"]];

it will open safari browser and redirect to required URL.

0

精彩评论

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

关注公众号