Skip to content

Commit

Permalink
Handle links specifying target="_blank"
Browse files Browse the repository at this point in the history
Have them open in a new tab, as Safari does
  • Loading branch information
barijaona committed Nov 17, 2024
1 parent adcbbfa commit cdb223d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Vienna/Sources/Main window/BrowserTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,9 @@ extension BrowserTab: WKNavigationDelegate {
} else if optionKey {
decisionHandler(.cancel)
NSApp.appController.open(navigationAction.request.url, inPreferredBrowser: false)
} else if navigationAction.targetFrame == nil { // link with target="_blank"
decisionHandler(.cancel)
NSApp.appController.browser.createNewTabAfterSelected(navigationAction.request.url, inBackground: false, load: true)
} else {
decisionHandler(.allow)
}
Expand Down

0 comments on commit cdb223d

Please sign in to comment.