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) => {
|
window.webContents.setWindowOpenHandler((details) => {
|
||||||
// Open the link in a browser tab.
|
// Only open http and https links to prevent
|
||||||
shell.openExternal(details.url);
|
// security issues.
|
||||||
|
if (['https:', 'http:'].includes(new URL(details.url).protocol)) {
|
||||||
|
shell.openExternal(details.url);
|
||||||
|
}
|
||||||
return { action: 'deny' };
|
return { action: 'deny' };
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue