Skip to content

Commit abd7a08

Browse files
committed
fix: Prevent Webcontent to navigate (outside)
1 parent eee0024 commit abd7a08

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/ui/main/serverView/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,16 @@ const initializeServerWebContents = (
144144
});
145145
};
146146

147+
const handleWillNavigate = (event: Event): void => {
148+
event.preventDefault();
149+
};
150+
147151
guestWebContents.addListener('did-start-loading', handleDidStartLoading);
148152
guestWebContents.addListener('did-fail-load', handleDidFailLoad);
149153
guestWebContents.addListener('did-navigate-in-page', handleDidNavigateInPage);
150154
guestWebContents.addListener('context-menu', handleContextMenu);
151155
guestWebContents.addListener('before-input-event', handleBeforeInputEvent);
156+
guestWebContents.addListener('will-navigate', handleWillNavigate);
152157
};
153158

154159
export const attachGuestWebContentsEvents = async (): Promise<void> => {

0 commit comments

Comments
 (0)