From 1726a7c71185165b55fca05e13a7fb222fbf86be Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Sat, 15 Jan 2022 15:13:16 -0500 Subject: [PATCH] Allow navigating to the same url with a different fragment --- Reader/Screens/Read/ReadViewController.swift | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Reader/Screens/Read/ReadViewController.swift b/Reader/Screens/Read/ReadViewController.swift index df5517a..bbebd9d 100644 --- a/Reader/Screens/Read/ReadViewController.swift +++ b/Reader/Screens/Read/ReadViewController.swift @@ -163,6 +163,13 @@ extension ReadViewController: WKNavigationDelegate { func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy { if navigationAction.navigationType == .linkActivated { let url = navigationAction.request.url! + if url.fragment != nil { + var components = URLComponents(url: url, resolvingAgainstBaseURL: false)! + components.fragment = nil + if components.url == item.url { + return .allow + } + } present(createSafariVC(url: url), animated: true) return .cancel } else {