mirror of
https://github.com/agam778/MS-365-Electron.git
synced 2026-02-17 09:02:10 +00:00
Replace new-window event with setWindowOpenHandler
This commit is contained in:
6
main.js
6
main.js
@@ -554,10 +554,12 @@ app.on("ready", () => {
|
||||
});
|
||||
|
||||
app.on("web-contents-created", (event, contents) => {
|
||||
contents.on("new-window", (event, url) => {
|
||||
contents.setWindowOpenHandler(({ url }) => {
|
||||
if (store.get("websites-in-new-window") === "false") {
|
||||
event.preventDefault();
|
||||
BrowserWindow.getFocusedWindow().loadURL(url);
|
||||
return { action: "deny" };
|
||||
} else {
|
||||
return { action: "allow" };
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user