There is a very easy (but not documented) way to set the User Agent header for HTTP requests sent via UIWebView.

I find saw the solution from mphweb.

Basically, you just set register it with NSUserDefaults.

+ (void)initialize {
    // Set user agent (the only problem is that we can't modify the User-Agent later in the program)
    NSDictionary *dictionnary = [[NSDictionary alloc] initWithObjectsAndKeys:@"Your desired user agent", @"UserAgent", nil];
    [[NSUserDefaults standardUserDefaults] registerDefaults:dictionnary];
    [dictionnary release];




Back to Home