mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-04-27 16:10:32 +00:00
open external links in default web browser instead of electron
This commit is contained in:
parent
de5b85360d
commit
8cfb5449fd
1 changed files with 19 additions and 0 deletions
|
|
@ -108,6 +108,25 @@ app.whenReady().then(async () => {
|
|||
},
|
||||
});
|
||||
|
||||
// open external links in default web browser instead of electron
|
||||
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
||||
|
||||
// open internal MeshChat urls starting with http://localhost in electron
|
||||
// this is needed for pages such as call.html that open in a new window
|
||||
if(url.startsWith("http://localhost")){
|
||||
return {
|
||||
action: "allow",
|
||||
};
|
||||
}
|
||||
|
||||
// fallback to opening any other url in external browser
|
||||
shell.openExternal(url);
|
||||
return {
|
||||
action: "deny",
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
// navigate to loading page
|
||||
await mainWindow.loadFile(path.join(__dirname, 'loading.html'));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue