How do i emulate iphone safari with WebView in Mac os?
Question
I have change the User_Agent to @"Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0_1 like Mac OS X; zh-cn) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A306 Safari/6531.22.7" which doesnot work. Any body can help me ? Thx in advance.
Solution
In your WebView, you can specify the userAgent string… from Apple's Docs..
setCustomUserAgent:Sets the receiver’s custom user-agent string.
- (void)setCustomUserAgent:(NSString *)userAgentString
Parameters 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.
As far as the actual string to set it to... how about...
Mozilla/5.0 (iPhone; CPU iPhone OS 6_1_3 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10B329 Safari/8536.25
OTHER TIPS
you can download the developer tools (XCode) for iPhone development which includes an iOS Simulator. You can test websites with it, too.