I have implemented the accepted solutions here and it does work for
some websites. For eg: Go to www.tomcruise.com and click on his trailers. Each of those links have target="_blank" and started opening after implementing the solution suggested in the previously linked stack overflow post.
But now I found that if we go to here and click on any link(the one I tried, as of writing this question, has a href tag as below
<a rel="nofollow" target="_blank" href="http://www.nowmagazine.co.uk/celebrity-news/victoria-and-david-beckham-fighting-to-be-together-296082" class="ot-anchor aaTEdf" jslog="10929; track:click" dir="ltr">http://www.nowmagazine.co.uk/celebrity-news/victoria-and-david-beckham-fighting-to-be-together-296082</a>
When I click on this link from inside WKWebView, the WKUIDelegate method below, does get called but has navigationAction.request = "" and hence nothing happens when webView.loadRequest("") gets called. Anyone else face this issue?
optional func webView(_ webView: WKWebView, createWebViewWithConfiguration configuration: WKWebViewConfiguration,
forNavigationAction navigationAction: WKNavigationAction,
windowFeatures windowFeatures: WKWindowFeatures) -> WKWebView?{
if navigationAction.targetFrame == nil {
webView.loadRequest(navigationAction.request)
}
return nil
}
- What is special about the above specified href tag that is causing the WKUIDelegate method to be called with an empty url?
- How do we fix this issue? Let me know how you root caused the issue as I am interested in debugging as well.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…