diff --git a/src/ios/CDVInAppBrowser.m b/src/ios/CDVInAppBrowser.m index 7cffac3..6ccdd50 100644 --- a/src/ios/CDVInAppBrowser.m +++ b/src/ios/CDVInAppBrowser.m @@ -47,6 +47,11 @@ _callbackIdPattern = nil; } +- (id)settingForKey:(NSString*)key +{ + return [self.commandDelegate.settings objectForKey:[key lowercaseString]]; +} + - (void)onReset { [self close:nil]; @@ -137,8 +142,16 @@ } if (self.inAppBrowserViewController == nil) { - NSString* originalUA = [CDVUserAgentUtil originalUserAgent]; - self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:originalUA prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions]; + NSString* userAgent = [CDVUserAgentUtil originalUserAgent]; + NSString* overrideUserAgent = [self settingForKey:@"OverrideUserAgent"]; + NSString* appendUserAgent = [self settingForKey:@"AppendUserAgent"]; + if(overrideUserAgent){ + userAgent = overrideUserAgent; + } + if(appendUserAgent){ + userAgent = [userAgent stringByAppendingString: appendUserAgent]; + } + self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:userAgent prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions]; self.inAppBrowserViewController.navigationDelegate = self; if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {