Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Development: How can I force a UIWebView to load the non-mobile version of Facebook?

I'm diving into iOS development and when I try to load a specific Facebook Fan Page in a UIWebView, it loads the mobile version of the site, which only loads the wall of the Fan Page instead of a specific tab that I need loaded. In the iPad version of my app, the UIWebView loads the normal, non-mobile version of Facebook and it loads the tab just fine. How can I force the UIWebView on the iPhone to load the normal version of Facebook?

like image 455
BeachRunnerFred Avatar asked May 19 '11 22:05

BeachRunnerFred


1 Answers

Facebook is most likely analyzing the user agent to determine which version to serve. If this is the case then changing the user agent to a desktop browser user agent would cause facebook to change which page version is served. You can change the user agent on NSMutableURLRequest like so:

[request setValue:@"some-user-agent" forHTTPHeaderField:@"User_Agent"];
like image 69
jaminguy Avatar answered Oct 11 '22 06:10

jaminguy