Up until recently
let url = NSURL (string:http://asite.com)
let request = NSMutableURLRequest(URL: url!)
//iOS loads the mobile version of
One way to resolve this it's by setting applicationNameForUserAgent property of WKWebViewConfiguration.
The default value is "Mobile/13C75", but you can set it with "Chrome/23.0.1271.6 Safari/537.11" or just "Chrome Safari" and you will get the desktop version of the requested URL.
WKWebViewConfiguration *wkWebConfig = [[WKWebViewConfiguration alloc] init];
wkWebConfig.applicationNameForUserAgent = @"Chrome Safari";
WKWebView *webView = [[WKWebView alloc] initWithFrame:CGRectZero
configuration:wkWebConfig];
To help any who find themselves here for an answer. The solution was
UserDefaults.standard.register(defaults: ["UserAgent" : "Chrome Safari"])
Swift 4:
@IBOutlet weak var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
self.webView.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/601.6.17 (KHTML, like Gecko) Version/9.1.1 Safari/601.6.17"
}