WKNavigationDelegate の decidePolicyForNavigationAction で許可してあげる必要があるようです。
参考: https://stackoverflow.com/a/58114892/1019868
参考: WKWebViewについてのまとめ - Qiita
Swift
1class ViewController: UIViewController {
2
3 @IBOutlet weak var webView: WKWebView!
4
5 override func viewDidLoad() {
6 super.viewDidLoad()
7 webView.navigationDelegate = self
8 }
9
10 func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
11 print("decidePolicyForAction: (navigationAction)")
12 decisionHandler(.allow)
13 }
14}
ObjC
1@interface ViewController () <WKNavigationDelegate>
2
3@property (weak, nonatomic) IBOutlet WKWebView *webView;
4
5@end
6
7@implementation ViewController
8
9- (void)viewDidLoad {
10 [super viewDidLoad];
11 _webView.navigationDelegate = self;
12}
13
14- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
15 decisionHandler(WKNavigationActionPolicyAllow);
16}
17
18@end