diff --git a/src/ios/CDVWKInAppBrowser.m b/src/ios/CDVWKInAppBrowser.m index 121223fc0..7deb6d01e 100644 --- a/src/ios/CDVWKInAppBrowser.m +++ b/src/ios/CDVWKInAppBrowser.m @@ -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); }