Post

Replies

Boosts

Views

Activity

Reply to iPad iOS16+ Can't load "https://www.baidu.com/s?wd=123" in WKWebView
I did two things to solve this problem, here is the example code: let webConfiguration = WKWebViewConfiguration() if UIDevice.current.userInterfaceIdiom != .phone { let prefer = WKWebpagePreferences() prefer.preferredContentMode = .mobile webConfiguration.defaultWebpagePreferences = prefer } webView = WKWebView(frame: .zero, configuration: webConfiguration) if UIDevice.current.userInterfaceIdiom != .phone { webView.customUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 Safari/605.1.15" }
Jan ’24