diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index 9260e3bb1..4827e9184 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -49,6 +49,8 @@ void SetDefaultPrefs(content::WebPreferences& web) { const base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); + web.javascript_enabled = + !command_line->HasSwitch(switches::kDisableJavascript); web.allow_scripts_to_close_windows = !command_line->HasSwitch(switches::kDisableJavascriptCloseWindows); web.javascript_can_access_clipboard = diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc index e4b055223..3b7f4f872 100644 --- a/libcef/common/cef_switches.cc +++ b/libcef/common/cef_switches.cc @@ -29,6 +29,9 @@ const char kUncaughtExceptionStackSize[] = "uncaught-exception-stack-size"; // Default encoding. const char kDefaultEncoding[] = "default-encoding"; +// Disable JavaScript. +const char kDisableJavascript[] = "disable-javascript"; + // Disable closing of windows via JavaScript. const char kDisableJavascriptCloseWindows[] = "disable-javascript-close-windows"; diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h index c56dfb4e9..8e15d6100 100644 --- a/libcef/common/cef_switches.h +++ b/libcef/common/cef_switches.h @@ -23,6 +23,7 @@ extern const char kLocalesDirPath[]; extern const char kDisablePackLoading[]; extern const char kUncaughtExceptionStackSize[]; extern const char kDefaultEncoding[]; +extern const char kDisableJavascript[]; extern const char kDisableJavascriptCloseWindows[]; extern const char kDisableJavascriptAccessClipboard[]; extern const char kDisableJavascriptDomPaste[];