Allow overriding of user-agent on UIWebView

Number:rdar://11767306 Date Originated:June 28, 2012
Status:Duplicate/5856047 Resolved:
Product:iPhone SDK Product Version:5.0
Classification:Enhancement Reproducible:

For some use cases it is necessary to modify the user agent that UIWebView sends towards the server to get a different version of the content. Such scenarios where we needed that included opening a special version of an online shopping bag or opening the full-version of Facebook instead of the mobile one.

Suggested Solution:

Expose a userAgent property on UIWebView that uses the default user-agent when nil or otherwise sends the set string. The reason why this should be a feature in the SDK is that most of the time when dealing with online hosted platform providers you have next to no chance of getting them to fix some detection mechanism that causes their platform to send the incorrect content. 

To make it easier for the developer there could be some methods that would give me certain predefined user agents, like Safari for Mac, to be used with the suggested property.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!