Allow navigating to the same url with a different fragment
This commit is contained in:
parent
36fda4d51f
commit
1726a7c711
|
@ -163,6 +163,13 @@ extension ReadViewController: WKNavigationDelegate {
|
||||||
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
|
||||||
if navigationAction.navigationType == .linkActivated {
|
if navigationAction.navigationType == .linkActivated {
|
||||||
let url = navigationAction.request.url!
|
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)
|
present(createSafariVC(url: url), animated: true)
|
||||||
return .cancel
|
return .cancel
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue