Skip to content

Commit 9f4b729

Browse files
dpa99cjanpio
authored andcommitted
GH-417: Handle non-default target attribute values (e.g. target=on links in WKWebView implementation on iOS (#418)
1 parent 6db2f2d commit 9f4b729

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ios/CDVWKInAppBrowser.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,14 @@ - (void)webView:(WKWebView *)theWebView decidePolicyForNavigationAction:(WKNavig
573573
}
574574

575575
if(shouldStart){
576-
decisionHandler(WKNavigationActionPolicyAllow);
576+
// Fix GH-417: Handle non-default target attribute
577+
// Based on https://stackoverflow.com/a/25853806/777265
578+
if (!navigationAction.targetFrame.isMainFrame){
579+
[theWebView loadRequest:navigationAction.request];
580+
decisionHandler(WKNavigationActionPolicyCancel);
581+
}else{
582+
decisionHandler(WKNavigationActionPolicyAllow);
583+
}
577584
}else{
578585
decisionHandler(WKNavigationActionPolicyCancel);
579586
}

0 commit comments

Comments
 (0)