diff --git a/SafeExamBrowser.Browser/BrowserApplication.cs b/SafeExamBrowser.Browser/BrowserApplication.cs index 97d4f14c..b2e8e4c1 100644 --- a/SafeExamBrowser.Browser/BrowserApplication.cs +++ b/SafeExamBrowser.Browser/BrowserApplication.cs @@ -184,24 +184,22 @@ namespace SafeExamBrowser.Browser { var warning = logger.LogLevel == LogLevel.Warning; var error = logger.LogLevel == LogLevel.Error; - var cefSettings = new CefSettings - { - CachePath = appConfig.BrowserCachePath, - LogFile = appConfig.BrowserLogFilePath, - LogSeverity = error ? LogSeverity.Error : (warning ? LogSeverity.Warning : LogSeverity.Info), - PersistSessionCookies = !settings.DeleteCookiesOnShutdown, - UserAgent = InitializeUserAgent() - }; - - InitializeProxySettings(cefSettings); + var cefSettings = new CefSettings(); + cefSettings.CachePath = appConfig.BrowserCachePath; cefSettings.CefCommandLineArgs.Add("touch-events", "enabled"); + cefSettings.LogFile = appConfig.BrowserLogFilePath; + cefSettings.LogSeverity = error ? LogSeverity.Error : (warning ? LogSeverity.Warning : LogSeverity.Info); + cefSettings.PersistSessionCookies = !settings.DeleteCookiesOnShutdown; + cefSettings.UserAgent = InitializeUserAgent(); if (!settings.AllowPdfReader) { cefSettings.CefCommandLineArgs.Add("disable-pdf-extension", ""); } + InitializeProxySettings(cefSettings); + logger.Debug($"Cache Path: {cefSettings.CachePath}"); logger.Debug($"Engine Version: Chromium {Cef.ChromiumVersion}, CEF {Cef.CefVersion}, CefSharp {Cef.CefSharpVersion}"); logger.Debug($"Log File: {cefSettings.LogFile}"); @@ -245,10 +243,6 @@ namespace SafeExamBrowser.Browser } } - /// - /// TODO: Workaround to correctly set the user agent due to missing support for request interception for requests made by service workers. - /// Remove once CEF fully supports service workers and reactivate the functionality in ! - /// private string InitializeUserAgent() { var osVersion = $"{Environment.OSVersion.Version.Major}.{Environment.OSVersion.Version.Minor}"; diff --git a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs index b0a6edaf..8d457bac 100644 --- a/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs +++ b/SafeExamBrowser.Browser/Handlers/ResourceHandler.cs @@ -90,12 +90,6 @@ namespace SafeExamBrowser.Browser.Handlers { var headers = new NameValueCollection(request.Headers); var urlWithoutFragment = request.Url.Split('#')[0]; - var userAgent = request.Headers["User-Agent"]; - - // TODO: CEF does not yet support intercepting requests from service workers, thus the user agent must be statically set at browser - // startup for now. Once CEF has full support of service workers, the static user agent should be removed and the method below - // reactivated. See https://bitbucket.org/chromiumembedded/cef/issues/2622 for the current status of development. - // headers["User-Agent"] = $"{userAgent} SEB/{appConfig.ProgramInformationalVersion}"; if (settings.SendConfigurationKey) {