如何检测WKWebView中单击链接的时间?我在UIWebView中寻找相当于此的东西.
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
{
if(navigationType == UIWebViewNavigationTypeLinkClicked)
{
}
return YES;
}
Run Code Online (Sandbox Code Playgroud)
我试过这个,WKNavigationDelegate但WKNavigationTypeOther即使点击链接,我也只能得到所有请求.
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler
{
if(navigationAction.navigationType == WKNavigationTypeLinkActivated)
{
}
decisionHandler(WKNavigationActionPolicyAllow);
}
Run Code Online (Sandbox Code Playgroud)