use this code can solve the problem, I found it from apple sample code, and I have the same problem on MacOS
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction preferences:(WKWebpagePreferences *)preferences decisionHandler:(void (^)(WKNavigationActionPolicy, WKWebpagePreferences *))decisionHandler{
[preferences setPreferredContentMode:WKContentModeMobile];
decisionHandler(WKNavigationActionPolicyAllow, preferences);
}
here is the apple sample code of WKWebView, if you enter https://www.baidu.com, the problem appears, if you change it to mobile mode, it will be ok