mirror of
https://github.com/status-im/react-native-webview.git
synced 2026-08-31 19:51:10 +00:00
feat(WKwebview): Allow _target links to be opened up in the same way as UIWebView. (#270)
Fixes #139
This commit is contained in:
committed by
Thibault Malbranche
parent
bf3f790358
commit
6643a8e38d
@@ -73,6 +73,17 @@ static NSString *const MessageHanderName = @"ReactNative";
|
||||
return self;
|
||||
}
|
||||
|
||||
/**
|
||||
* See https://stackoverflow.com/questions/25713069/why-is-wkwebview-not-opening-links-with-target-blank/25853806#25853806 for details.
|
||||
*/
|
||||
- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures
|
||||
{
|
||||
if (!navigationAction.targetFrame.isMainFrame) {
|
||||
[webView loadRequest:navigationAction.request];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)didMoveToWindow
|
||||
{
|
||||
if (self.window != nil && _webView == nil) {
|
||||
|
||||
Reference in New Issue
Block a user