From 7feb3a68cf21c2350eb4f632bea14239ced22d5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damian=20B=C3=BCchel?= Date: Mon, 15 Feb 2021 23:49:23 +0100 Subject: [PATCH] SEBWIN-463: Ensured clicking a link with keyboard modifiers doesn't activate default browser behavior. --- .../Handlers/RequestHandler.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/SafeExamBrowser.Browser/Handlers/RequestHandler.cs b/SafeExamBrowser.Browser/Handlers/RequestHandler.cs index 015ff629..f0499789 100644 --- a/SafeExamBrowser.Browser/Handlers/RequestHandler.cs +++ b/SafeExamBrowser.Browser/Handlers/RequestHandler.cs @@ -94,6 +94,21 @@ namespace SafeExamBrowser.Browser.Handlers return base.OnBeforeBrowse(webBrowser, browser, frame, request, userGesture, isRedirect); } + protected override bool OnOpenUrlFromTab(IWebBrowser webBrowser, IBrowser browser, IFrame frame, string targetUrl, WindowOpenDisposition targetDisposition, bool userGesture) + { + switch (targetDisposition) + { + case WindowOpenDisposition.NewBackgroundTab: + case WindowOpenDisposition.NewForegroundTab: + case WindowOpenDisposition.NewPopup: + case WindowOpenDisposition.NewWindow: + case WindowOpenDisposition.SaveToDisk: + return true; + default: + return base.OnOpenUrlFromTab(webBrowser, browser, frame, targetUrl, targetDisposition, userGesture); + } + } + private bool IsQuitUrl(IRequest request) { var isQuitUrl = false;