需要遵守<WKNavigationDelegate>并实现以下代理方法
- (void) webView:(WKWebView*)webView decidePolicyForNavigationAction:(WKNavigationAction*)navigationAction decisionHandler:(void(^)(WKNavigationActionPolicy))decisionHandler{
if(navigationAction.targetFrame == nil) {
[webViewloadRequest:navigationAction.request];
}
decisionHandler(WKNavigationActionPolicyAllow);
}
网友评论