Skip to content

Commit c5787c6

Browse files
committed
Make urls open in default browser instead of electron.
1 parent bc324b5 commit c5787c6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/background.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
import { app, protocol, BrowserWindow, Config, screen } from 'electron'
3+
import { app, protocol, BrowserWindow, Config, screen, shell } from 'electron'
44
import {
55
createProtocol,
66
installVueDevtools
@@ -39,7 +39,14 @@ function createWindow() {
3939
win.on('closed', () => {
4040
win = null
4141
})
42+
43+
win.webContents.on('new-window', function(e, url){
44+
e.preventDefault();
45+
shell.openExternal(url);
46+
});
47+
4248
}
49+
4350
import * as fs from 'fs';
4451
import * as path from 'path';
4552
function ensureExists(callback) {
@@ -123,6 +130,7 @@ if (!locked) {
123130
})
124131
}
125132

133+
126134
// Exit cleanly on request from parent process in development mode.
127135
if (isDevelopment) {
128136
if (process.platform === 'win32') {

0 commit comments

Comments
 (0)