(ios): allow to set "preferredContentMode" (#688)
PreferredContentMode can now be set with preference config. Since iPadOS came out iPads get a desktop Safari useragent by default. see #687 Co-authored-by: Tim Brust <github@timbrust.de>
This commit is contained in:
@@ -757,6 +757,15 @@ BOOL isExiting = FALSE;
|
||||
configuration.mediaPlaybackRequiresUserAction = _browserOptions.mediaplaybackrequiresuseraction;
|
||||
}
|
||||
|
||||
if (@available(iOS 13.0, *)) {
|
||||
NSString *contentMode = [self settingForKey:@"PreferredContentMode"];
|
||||
if ([contentMode isEqual: @"mobile"]) {
|
||||
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeMobile;
|
||||
} else if ([contentMode isEqual: @"desktop"]) {
|
||||
configuration.defaultWebpagePreferences.preferredContentMode = WKContentModeDesktop;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
self.webView = [[WKWebView alloc] initWithFrame:webViewBounds configuration:configuration];
|
||||
|
||||
Reference in New Issue
Block a user