Skip to content

Commit

Permalink
try javascript false
Browse files Browse the repository at this point in the history
  • Loading branch information
crypto-matto committed Jan 16, 2024
1 parent c928658 commit 14ab4c5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,22 @@ app.on('web-contents-created', (event, contents) => {
console.log('will-navigate', url)
if (!isValidURL(url)) {
event.preventDefault();
return;
}
})
}

if (contents.getType() == 'webview') {
// blocks any new windows from being opened
contents.on('new-window', (event) => {
contents.on('new-window', (event, url, frameName, disposition, options) => {
console.log('new-window', frameName, disposition, options)
options.webPreferences = {
...options.webPreferences,
javascript: false,
};
event.preventDefault();
require('electron').shell.openExternal(url);
return;
})

contents.on('will-navigate', (event, url) => {
Expand Down

0 comments on commit 14ab4c5

Please sign in to comment.