View Full Version : Spoofing user agent in WebView

Apr 1, 2011, 09:59 PM
Hi guys, I wrote a program that loads a couple web pages, but I need them to display in the iphone style. if you go to news.google.com on your mac, as compared with you iPhone it displays a different page. I really need this page to be displayed in the iPhone version in my program. How is this possible using the WebKit ?

Apr 2, 2011, 12:35 AM
Quote from WebView docs.

- (void)setCustomUserAgent:(NSString *)userAgentString

The custom user-agent string. The user-agent string is used by websites to identify the client browser. The custom user-agent string is used for all URLs. If nil, then the receiver constructs a user-agent string that produces the best rendering results for each URL.

Apr 2, 2011, 01:21 AM
Thank you for the information, but I am having trouble implementing it. How do I link this to my webview instance?

Never mind I have figured it out! :)