Help Center

CWebView2.IsScriptEnabledproperty

Determines whether running JavaScript is enabled in all future navigations in the WebView.

WebViewpropertydocumented

Syntax

PROPERTY IsScriptEnabled () AS BOOLEAN
PROPERTY IsScriptEnabled (BYVAL enabled AS BOOLEAN) AS HRESULT

Description

Controls if running JavaScript is enabled in all future navigations in the WebView. This only affects scripts in the document. Scripts injected with ExecuteScript runs even if script is disabled. The default value is TRUE.

Remarks

Changes to settings will apply at the next navigation, which includes the navigation after a NavigationStarting event. We can use this to change settings according to what site we're visiting.

Reference

  • Defined in AfxNova/CWebView2.inc:984
  • Documented in WebView/CWebWiew2 Class.md
  • Topic: CWebView2 Class