Only allow to window.open http and https protocols.
This commit is contained in:
parent
8fb67d5980
commit
aa40a44ce3
1 changed files with 5 additions and 2 deletions
|
@ -191,8 +191,11 @@ export default appState => {
|
|||
});
|
||||
|
||||
window.webContents.setWindowOpenHandler((details) => {
|
||||
// Open the link in a browser tab.
|
||||
shell.openExternal(details.url);
|
||||
// Only open http and https links to prevent
|
||||
// security issues.
|
||||
if (['https:', 'http:'].includes(new URL(details.url).protocol)) {
|
||||
shell.openExternal(details.url);
|
||||
}
|
||||
return { action: 'deny' };
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue