mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-19 08:03:50 +02:00
MESSENGER-1678 add webview navigation policy
This commit is contained in:
committed by
Frank Rotermund
parent
b76b4e0803
commit
99d75ecf01
@@ -350,4 +350,18 @@ NSString *const kMXKWebViewViewControllerJavaScriptEnableLog =
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - BWI: WebViewLinkPolicy
|
||||
-(void)webView:(WKWebView *)webview decidePolicyForNavigationAction:(nonnull WKNavigationAction *)navigationAction decisionHandler:(nonnull void (^)(WKNavigationActionPolicy))decisionHandler
|
||||
{
|
||||
if (navigationAction.navigationType == WKNavigationTypeLinkActivated) {
|
||||
// bwi: clicked links should be opened in system browser
|
||||
[[UIApplication sharedApplication] openURL:navigationAction.request.URL options:@{} completionHandler:nil];
|
||||
decisionHandler(WKNavigationActionPolicyCancel);
|
||||
} else {
|
||||
// bwi: Open url in webview
|
||||
decisionHandler(WKNavigationActionPolicyAllow);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user