« Upcoming FMTraining L… | Home | FileMaker Konferenz 2… »

WebPreferences for WebView2

Our way to add Microsoft/Edge support for FileMaker continues, the WebView2 control. It will be in MBS FileMaker Plugin 11.5 and the work for our users once FileMaker 19.4 ships, probably later this year.



Part of the functionality we got is new preferences:

AreDefaultContextMenusEnabled

Used to prevent default context menus from being shown to user in WebView.
The default value is true, but FileMaker may overwrite this.

AreDefaultScriptDialogsEnabled

If set to false, WebView2 does not render the default JavaScript dialog box (Specifically those displayed by the JavaScript alert, confirm, prompt functions and beforeunload event). Instead, if an event handler is set using add_ScriptDialogOpening, WebView sends an event that contains all of the information for the dialog and allow the host app to show a custom UI. The default value is true.

AreDevToolsEnabled

Controls whether the user is able to use the context menu or keyboard shortcuts to open the DevTools window.
The default value is true.

AreHostObjectsAllowed

The AreHostObjectsAllowed property is used to control whether host objects are accessible from the page in WebView.
The default value is true.

IsBuiltInErrorPageEnabled

The IsBuiltInErrorPageEnabled property is used to disable built in error page for navigation failure and render process failure.
When disabled, a blank page is displayed when the related error happens. The default value is true.

IsScriptEnabled

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.

IsStatusBarEnabled

Controls whether the status bar is displayed.
The status bar is usually displayed in the lower left of the WebView and shows things such as the URI of a link when the user hovers over it and other information. The default value is true. The status bar UI can be altered by web content and should not be considered secure.

IsWebMessageEnabled

If set to true, communication from the host to the top-level HTML document of the WebView is allowed using PostWebMessageAsJson, PostWebMessageAsString, and message event of window.chrome.webview. For more information, navigate to PostWebMessageAsJson. Communication from the top-level HTML document of the WebView to the host is allowed using the postMessage function of window.chrome.webview and add_WebMessageReceived method. For more information, navigate to add_WebMessageReceived. If set to false, then communication is disallowed. PostWebMessageAsJson and PostWebMessageAsString fails with E_ACCESSDENIED and window.chrome.webview.postMessage fails by throwing an instance of an Error object. The default value is true.

IsZoomControlEnabled

Used to prevent the user from impacting the zoom of the WebView.
When disabled, the user is not able to zoom using Ctrl++, Ctrl+-, or Ctrl+mouse wheel, but the zoom is set using ZoomFactor API. The default value is true.

User Agent Name

The WebView2 control allows you to change the user agent name and we implemented this via WebView.SetCustomUserAgent function .

Setting preferences

Once you have the new plugin installed with FileMaker 19.4, you can get the preferences with our WebView.GetPreferences function and put in new values with the WebView.SetPreferences function. This allows you a few configuration things within your script. Best is to define the control with "about:blank" URL to have FileMaker initialize the WebViewer early. Then setup configuration options and load the website you need. FileMaker Plugin
05 11 21 - 10:47

Start Chat