diff --git a/SafeExamBrowser.Browser/Content/ContentLoader.cs b/SafeExamBrowser.Browser/Content/ContentLoader.cs
index 3e2418df..bb7e19ce 100644
--- a/SafeExamBrowser.Browser/Content/ContentLoader.cs
+++ b/SafeExamBrowser.Browser/Content/ContentLoader.cs
@@ -18,6 +18,7 @@ namespace SafeExamBrowser.Browser.Content
private string api;
private string clipboard;
+ private string pageZoom;
internal ContentLoader(IText text)
{
@@ -97,5 +98,22 @@ namespace SafeExamBrowser.Browser.Content
return clipboard;
}
+
+ internal string LoadPageZoom()
+ {
+ if (pageZoom == default)
+ {
+ var assembly = Assembly.GetAssembly(typeof(ContentLoader));
+ var path = $"{typeof(ContentLoader).Namespace}.PageZoom.js";
+
+ using (var stream = assembly.GetManifestResourceStream(path))
+ using (var reader = new StreamReader(stream))
+ {
+ pageZoom = reader.ReadToEnd();
+ }
+ }
+
+ return pageZoom;
+ }
}
}
diff --git a/SafeExamBrowser.Browser/Content/PageZoom.js b/SafeExamBrowser.Browser/Content/PageZoom.js
new file mode 100644
index 00000000..e9b20125
--- /dev/null
+++ b/SafeExamBrowser.Browser/Content/PageZoom.js
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2024 ETH Zürich, IT Services
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+function disableMouseWheelZoom(e) {
+ if (e.ctrlKey) {
+ e.preventDefault();
+ e.stopPropagation();
+ }
+}
+
+document.addEventListener('wheel', disableMouseWheelZoom, { passive: false });
\ No newline at end of file
diff --git a/SafeExamBrowser.Browser/Handlers/RenderProcessMessageHandler.cs b/SafeExamBrowser.Browser/Handlers/RenderProcessMessageHandler.cs
index 71c041c0..3f162509 100644
--- a/SafeExamBrowser.Browser/Handlers/RenderProcessMessageHandler.cs
+++ b/SafeExamBrowser.Browser/Handlers/RenderProcessMessageHandler.cs
@@ -40,9 +40,15 @@ namespace SafeExamBrowser.Browser.Handlers
var configurationKey = keyGenerator.CalculateConfigurationKeyHash(settings.ConfigurationKey, frame.Url);
var api = contentLoader.LoadApi(browserExamKey, configurationKey, appConfig.ProgramBuildVersion);
var clipboardScript = contentLoader.LoadClipboard();
+ var pageZoomScript = contentLoader.LoadPageZoom();
frame.ExecuteJavaScriptAsync(api);
+ if (!settings.AllowPageZoom)
+ {
+ frame.ExecuteJavaScriptAsync(pageZoomScript);
+ }
+
if (!settings.AllowPrint)
{
frame.ExecuteJavaScriptAsync($"window.print = function() {{ alert('{text.Get(TextKey.Browser_PrintNotAllowed)}') }}");
diff --git a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
index 83bcad06..cf590445 100644
--- a/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
+++ b/SafeExamBrowser.Browser/SafeExamBrowser.Browser.csproj
@@ -194,7 +194,9 @@
-
+
+
+
diff --git a/SafeExamBrowser.UserInterface.Desktop/Windows/BrowserWindow.xaml.cs b/SafeExamBrowser.UserInterface.Desktop/Windows/BrowserWindow.xaml.cs
index 50e8d45b..5282abbf 100644
--- a/SafeExamBrowser.UserInterface.Desktop/Windows/BrowserWindow.xaml.cs
+++ b/SafeExamBrowser.UserInterface.Desktop/Windows/BrowserWindow.xaml.cs
@@ -533,7 +533,6 @@ if (typeof __SEB_focusElement === 'undefined') {
ForwardButton.Visibility = WindowSettings.AllowForwardNavigation ? Visibility.Visible : Visibility.Collapsed;
HomeButton.IsEnabled = WindowSettings.ShowHomeButton;
HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed;
- MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.ShowReloadButton ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;
diff --git a/SafeExamBrowser.UserInterface.Mobile/Windows/BrowserWindow.xaml.cs b/SafeExamBrowser.UserInterface.Mobile/Windows/BrowserWindow.xaml.cs
index 32680920..405db84d 100644
--- a/SafeExamBrowser.UserInterface.Mobile/Windows/BrowserWindow.xaml.cs
+++ b/SafeExamBrowser.UserInterface.Mobile/Windows/BrowserWindow.xaml.cs
@@ -528,7 +528,6 @@ if (typeof __SEB_focusElement === 'undefined') {
ForwardButton.Visibility = WindowSettings.AllowForwardNavigation ? Visibility.Visible : Visibility.Collapsed;
HomeButton.IsEnabled = WindowSettings.ShowHomeButton;
HomeButton.Visibility = WindowSettings.ShowHomeButton ? Visibility.Visible : Visibility.Collapsed;
- MenuButton.IsEnabled = settings.AllowPageZoom || WindowSettings.AllowDeveloperConsole;
ReloadButton.IsEnabled = WindowSettings.AllowReloading;
ReloadButton.Visibility = WindowSettings.ShowReloadButton ? Visibility.Visible : Visibility.Collapsed;
Toolbar.Visibility = WindowSettings.ShowToolbar ? Visibility.Visible : Visibility.Collapsed;