Skip to content
Permalink
Browse files
GH-417: Handle non-default target attribute values (e.g. target=on li…
…nks in WKWebView implementation on iOS (#418)
  • Loading branch information
dpa99c authored and janpio committed Feb 10, 2019
1 parent 6db2f2d commit 9f4b72982abf50ddc54a34bd3748b6a3aad3be57
Showing 1 changed file with 8 additions and 1 deletion.
@@ -573,7 +573,14 @@ - (void)webView:(WKWebView *)theWebView decidePolicyForNavigationAction:(WKNavig
}

if(shouldStart){
decisionHandler(WKNavigationActionPolicyAllow);
// Fix GH-417: Handle non-default target attribute
// Based on https://stackoverflow.com/a/25853806/777265
if (!navigationAction.targetFrame.isMainFrame){
[theWebView loadRequest:navigationAction.request];
decisionHandler(WKNavigationActionPolicyCancel);
}else{
decisionHandler(WKNavigationActionPolicyAllow);
}
}else{
decisionHandler(WKNavigationActionPolicyCancel);
}

0 comments on commit 9f4b729

Please sign in to comment.