Skip to content

Commit cd16162

Browse files
committed
Fix electron browser open issues
1 parent e8bd7d3 commit cd16162

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/client/pages/ElectronWelcomePage.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,7 @@ function ElectronWelcomePage() {
4040
<span className='lead'>
4141
Please login using a web browser
4242
</span>
43-
<a
44-
className='link-primary'
45-
onClick={openBrowser}
46-
href="#"
47-
>
43+
<a className='link-primary'target='_blank' href={browserUrl} rel="noreferrer">
4844
Browser didn&apos;t open? Click here!
4945
</a>
5046
</>
@@ -65,7 +61,7 @@ function ElectronWelcomePage() {
6561

6662
function openBrowser() {
6763
setBrowserOpened(true);
68-
window.open(browserUrl);
64+
window.open(browserUrl, '_blank');
6965
}
7066
}
7167

src/electron/main.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class DokChatDesktop {
8080
}
8181
});
8282

83-
this.mainWindow.webContents.setWindowOpenHandler((details) => {
84-
shell.openExternal(details.url);
83+
this.mainWindow.webContents.setWindowOpenHandler(({ url }) => {
84+
shell.openExternal(url).catch((e) => log.error('Failed to open url', e));
8585
return { action: 'deny' };
8686
});
8787

0 commit comments

Comments
 (0)