Created
October 11, 2012 16:08
-
-
Save bluebanboom/3873469 to your computer and use it in GitHub Desktop.
Change UIWebView User-Agent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)req navigationType:(UIWebViewNavigationType)navigationType | |
{ | |
NSMutableURLRequest *request = (NSMutableURLRequest *)req; | |
if ([request respondsToSelector:@selector(setValue:forHTTPHeaderField:)]) { | |
[request setValue:@"Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16" forHTTPHeaderField:@"User_Agent"]; | |
} | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment