0

There are several ways to change the user agent header send by UIWebView. However the value of window.navigator.userAgent retrieved by JS on any page always contains the same value, something like "Mozilla/5.0 (iPad; U; CPU OS 4_2 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Mobile/8C134".

Is there any way to change that value without having to modify the HTML response (and insert some JS)?

Thanks in advance!

Community
  • 1
  • 1
muffel
  • 7,004
  • 8
  • 57
  • 98
  • There is no way, as far as I know. However, instead of modifying the HTML response, you could use `stringByEvaluatingJavaScriptFromString` to inject some Javascript code after the page has loaded. – pgb Aug 23 '12 at 19:48
  • @pgb thanks for your response! The problem regarding this is that I would need to create JS workarounds for each supported website. Isn't there any generic approach? – muffel Aug 24 '12 at 06:43
  • I don't think there is one. My suggestion -at least- allows you to inject the same JS code regardless of the HTML that comes back from the server. – pgb Aug 24 '12 at 19:40
  • @pgb but there isn't any place where the page has already been loaded but its JS hasn't been executed yet, is it? – muffel Aug 26 '12 at 07:19

0 Answers0