Reputation: 1380
For example website 'm.freemyapps.com' denies all the browsers and even UIWebView and requests Safari only.
Is it possible to make my app present itself as Safari?
Upvotes: 0
Views: 1063
Reputation: 961
If I understand your question correctly, you can do any of the two things-
1) You can redirect the user to leave the app and open the mobile site in Safari.
2) For mobile site support, the UIWebView might need to add additional User-Agent header fields in the request, mimicking Safari. e.g.
NSURL *url = [NSURL URLWithString:@"m.freemyapps.com"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setValue:@"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Version/3.0 Mobile/1A543a Safari/419.3" forHTTPHeaderField:@"User-Agent"];
[webview loadRequest: request];
In most of the cases, this solution should work. If this does not, you should find out with the server side implementation of the particular mobile site as to whether it requires additional headers to be sent.
Upvotes: 1