Revert change for internal link navigation, since it causes problems — the #fragment-linked section is frequently not included in the article in the feed, and the page really does need to open in browser. Reverts https://github.com/Ranchero-Software/NetNewsWire/pull/5080

This commit is contained in:
Brent Simmons committed 2026-03-13 20:52:56 -07:00
1 parent fe4b0f1219
commit 87ec1a160e
1 file changed
+1 -16
@@ -200,23 +200,8 @@ extension DetailWebViewController: WKNavigationDelegate, WKUIDelegate {
// WKNavigationDelegate
// Prevent user navigations within a page (for example, to elements with ids) from being dispatched to the browser
func isInternalPageNavigationAction(_ navigationAction: WKNavigationAction) -> Bool {
// If the origin and destination of the navigation have the same host and path, then
// the presence of a fragment should be considered "internal" to an article.
if let targetURL = navigationAction.request.url,
let fragment = targetURL.fragment, fragment.isEmpty == false,
let sourceURL = self.webView.url,
sourceURL.host == targetURL.host,
sourceURL.path == targetURL.path {
return true
} else {
return false
}
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping @MainActor @Sendable (WKNavigationActionPolicy) -> Void) {
if navigationAction.navigationType == .linkActivated, !isInternalPageNavigationAction(navigationAction) {
if navigationAction.navigationType == .linkActivated {
if let url = navigationAction.request.url {
self.openInBrowser(url, flags: navigationAction.modifierFlags)
}