I have a PhoneGap 3.0 app that I have built on the IOS platform.
I have added the following two lines to the didFinishLaunchingWithOptions
method of AppDelegate.m
to attempt to spoof a particular user agent (after looking through numerous SO questions):
NSDictionary *dictionary = [NSDictionary dictionaryWithObjectsAndKeys:@"my custom user agent", @"UserAgent", nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:dictionary];
When I run the app in the IOS simulator and inspect navigator.userAgent
, I get the expected "my custom user agent" as the output.
When I do a remote phonegap build, run the app on my iPhone and inspect navigator.userAgent
, I get the standard iPhone user agent, not my custom one.
Why am I getting different outputs from navigator.userAgent
on the simulator and my device?
Related SO questions: