mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-09-24 04:03:03 -04:00
Merge pull request #783 from kiwix/775-pdf-in-nautilus-made-zim-are-not-open-via-simple-click
Add support for target=blank links
This commit is contained in:
commit
f373d96349
@ -393,6 +393,24 @@ final class BrowserViewModel: NSObject, ObservableObject,
|
||||
_ = createNewTab(url: newUrl)
|
||||
return nil
|
||||
}
|
||||
#else
|
||||
func webView(
|
||||
_ webView: WKWebView,
|
||||
createWebViewWith configuration: WKWebViewConfiguration,
|
||||
for navigationAction: WKNavigationAction,
|
||||
windowFeatures: WKWindowFeatures
|
||||
) -> WKWebView? {
|
||||
guard let newURL = navigationAction.request.url else { return nil }
|
||||
if let frame = navigationAction.targetFrame, frame.isMainFrame {
|
||||
return nil
|
||||
}
|
||||
guard newURL.isExternal == false else {
|
||||
externalURL = newURL
|
||||
return nil
|
||||
}
|
||||
webView.load(navigationAction.request)
|
||||
return nil
|
||||
}
|
||||
#endif
|
||||
|
||||
#if os(iOS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user