Edit

WebViewControl (window, item, commandString)

Sets options on a custom web view control in a window. commandString is a string consisting of a command followed by parameters in the form name='value'. Additional parameters should be separated by spaces

Using command options — available options are: (all case-sensitive)

  • openLinksInExternalBrowser = 'true' or 'false'
  • wantCallbacks = 'true' or 'false'
  • enableInspector = 'true' or 'false'
  • addObserver = 'YourHandlerName'
  • setUserAgent = 'Your UA String'
  • wantContextualMenu = 'true' or 'false' (Windows)
  • allowBackForward = 'true' or 'false' (Mac, original Webkit)
  • reportErrors = 'true' or 'false' (Windows)
  • useWebView2IfAvailable = 'true' or 'false' (Windows, default is true, if false uses obsolete IWebBrowser2)
  • useWKWebview = 'true' or 'false' (Mac, default is true, if false uses obsolete WebView)

The openLinksInExternalBrowser setting determines whether opening a link will open it in the webview control itself or in an external browser. Note that on Windows, this also controls whether iframes open inline or externally. If you are displaying a web page that contains iframes on Windows, you will need to set the option to false at least until the page has been loaded. You may then set the option to true. Even better, avoid content with iframes on Windows.

Example: 

WebViewControl(w, "L_WEB", "options openLinksInExternalBrowser='true' wantURLCallback='true'")

The web view technology selection options must be invoked before creatng the web view, with NULL as the itemID param

WebViewControl(w, NULL, "options useWebView2IfAvailable='false'") // force use of IWebBrowser2 (IE browser)

Use command query to check that Webview2 is available (as of 2025 it should normally always be available on Windows 10 and 11)

WebViewControl(w, NULL, "query available='WebView2'") // returns true if WebView2 is available

Availability:  available within MWScript handlers.

See Also:

LoadHTMLInWebView: Load HTML into a custom web view control

LoadURLInWebView: Load a URL into a custom web view control