mirror of
https://github.com/open-webui/desktop.git
synced 2026-07-01 20:54:03 -04:00
fix: open links in default browser instead of within the app (#165)
This commit is contained in:
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.0.16] - 2026-05-02
|
||||
|
||||
### Fixed
|
||||
|
||||
- **Links Open in Default Browser.** Clicking links in chat responses now opens them in the user's default browser instead of navigating within the app or spawning a new Electron window (#165).
|
||||
|
||||
## [0.0.15] - 2026-04-28
|
||||
|
||||
### Added
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "open-webui",
|
||||
"version": "0.0.15",
|
||||
"version": "0.0.16",
|
||||
"license": "AGPL-3.0",
|
||||
"description": "Open WebUI Desktop",
|
||||
"main": "./out/main/index.js",
|
||||
|
||||
@@ -1236,6 +1236,10 @@ if (!gotTheLock) {
|
||||
|
||||
// Log webview guest renderer crashes for diagnostics — the existing
|
||||
// 'crashed' listener in Content.svelte surfaces these to the user.
|
||||
//
|
||||
// For webview guests we also intercept navigation and popup events
|
||||
// so that external links open in the user's default browser instead
|
||||
// of navigating the webview or spawning a new Electron window (#165).
|
||||
app.on('web-contents-created', (_event, contents) => {
|
||||
contents.on('render-process-gone', (_e, details) => {
|
||||
if (details.reason !== 'clean-exit') {
|
||||
@@ -1245,6 +1249,30 @@ if (!gotTheLock) {
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
if (contents.getType() === 'webview') {
|
||||
// ── Popups (target="_blank" links) → open in default browser ──
|
||||
contents.setWindowOpenHandler(({ url }) => {
|
||||
openUrl(url)
|
||||
return { action: 'deny' }
|
||||
})
|
||||
|
||||
// ── In-page navigation to a different origin → open externally ──
|
||||
// This catches regular link clicks (no target) that would navigate
|
||||
// the webview away from the Open WebUI instance.
|
||||
contents.on('will-navigate', (event, url) => {
|
||||
try {
|
||||
const currentOrigin = new URL(contents.getURL()).origin
|
||||
const targetOrigin = new URL(url).origin
|
||||
if (targetOrigin !== currentOrigin) {
|
||||
event.preventDefault()
|
||||
openUrl(url)
|
||||
}
|
||||
} catch {
|
||||
// Malformed URL — let it through so Chromium can handle/reject it
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
// ─── IPC Handlers ─────────────────────────────────
|
||||
|
||||
@@ -268,7 +268,6 @@
|
||||
src={connUrl}
|
||||
class="flex-1 min-h-0 border-none"
|
||||
style="display: {view === 'connected' && activeConnectionId === connId ? 'flex' : 'none'}"
|
||||
allowpopups
|
||||
partition="persist:connection-{connId}"
|
||||
preload={contentPreloadPath}
|
||||
></webview>
|
||||
|
||||
Reference in New Issue
Block a user