Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

WebView.SetPreferences

Sets WebView preferences parameters.

Component Version macOS Windows Linux Server iOS SDK
WebView 2.2 ✅ Yes ✅ Yes ❌ No ❌ No ✅ Yes
MBS( "WebView.SetPreferences"; WebViewerRef; ParameterName { ; ParameterValue } )   More

Parameters

Parameter Description Example Flags
WebViewerRef Either the Web Viewer Object Name or the Web Viewer ID as returned by "WebView.FindByName" function. "web"
ParameterName The name of the parameter. isJavaEnabled
ParameterValue The value for the given parameter: A boolean value for allowsAnimatedImageLooping, allowsAnimatedImages, javaEnabled, javaScriptCanOpenWindowsAutomatically, javaScriptEnabled, loadsImagesAutomatically, plugInsEnabled, privateBrowsingEnabled, shouldPrintBackgrounds, tabsToLinks, userStyleSheetEnabled and usesPageCache. A number for cacheModel, defaultFixedFontSize, defaultFontSize, minimumFontSize or minimumLogicalFontSize. A string for cursiveFontFamily, defaultTextEncodingName, fantasyFontFamily, fixedFontFamily, sansSerifFontFamily, serifFontFamily or standardFontFamily. 0 Optional

Result

Returns OK or an error message.

Description

Sets WebView preferences parameters.
For WebKit 1.x you can pass empty WebViewerRef to access global preferences.

Available keys for WebKit 1.x (FileMaker till version 15 and WebView.Create): allowsAnimatedImageLooping, allowsAnimatedImages, cacheModel, cursiveFontFamily, defaultFixedFontSize, defaultFontSize, defaultTextEncodingName, fantasyFontFamily, fixedFontFamily, javaEnabled, javaScriptCanOpenWindowsAutomatically, javaScriptEnabled, loadsImagesAutomatically, minimumFontSize, minimumLogicalFontSize, plugInsEnabled, privateBrowsingEnabled, sansSerifFontFamily, serifFontFamily, shouldPrintBackgrounds, standardFontFamily, tabsToLinks, userStyleSheetEnabled or usesPageCache.

Available keys for WebKit 2.x (FileMaker 16): shouldPrintBackgrounds, developerExtrasEnabled, logsPageMessagesToSystemConsoleEnabled, minimumFontSize, javaScriptEnabled, javaScriptCanOpenWindowsAutomatically, telephoneNumberDetectionIsEnabled, javaEnabled and plugInsEnabled.

New in version 10.2: mediaDevicesEnabled and mediaStreamEnabled to allow camera/microphone/screen access.
New in version 10.3: CrossOriginResourcePolicyEnabled and webSecurityEnabled to enable cross site scripting.

Please check WebKit documentation for details.

Implemented for Windows with Microsoft Edge/Chrome engine (WebView2) in MBS Plugin 11.5 when using FileMaker Pro 19.4 or newer.
Possible keys: IsScriptEnabled, IsWebMessageEnabled, AreDefaultScriptDialogsEnabled, IsStatusBarEnabled, AreDevToolsEnabled, AreDefaultContextMenusEnabled, AreHostObjectsAllowed, IsZoomControlEnabled, IsBuiltInErrorPageEnabled, areBrowserAcceleratorKeysEnabled, IsPinchZoomEnabled, IsPasswordAutosaveEnabled and IsGeneralAutofillEnabled.

MBS Plugin 11.5 adds fraudulentWebsiteWarningEnabled for macOS 10.15 and iOS 13.0 to set whether the warnings or fraudulent websites is enabled. The textInteractionEnabled setting in macOS 12.0 and iOS 15.0 allows to set whether text interactions are enabled.

Examples

set print background option:

MBS("WebView.SetPreferences"; $WebViewerRef; "shouldPrintBackgrounds", 1)

Disables image loading:

MBS("WebView.SetPreferences"; $WebViewerRef; "loadsImagesAutomatically", 0)

Disable Java:

MBS("WebView.SetPreferences"; $WebViewerRef; "javaEnabled"; 0)

Disable Plugins:

MBS("WebView.SetPreferences"; $WebViewerRef; "plugInsEnabled"; 0)

Set developer extras enabled state for WebViewer to show inspector:

Set Variable [$r; Value: MBS("Webview.SetPreferences"; "web"; "developerExtrasEnabled"; 1) ]

Enable file URLs:

Set Variable [$r; Value:MBS("Webview.SetPreferences"; "web"; "allowFileAccessFromFileURLs"; 1)]

Disable web security:

MBS( "WebView.SetPreferences"; "web"; "webSecurityEnabled"; 0 )

Disable cross origin resource policy enabled:

MBS( "WebView.SetPreferences"; "web"; "CrossOriginResourcePolicyEnabled"; 0)

Enable console messages to Console.app:

Set Variable [ $r ; Value: MBS( "WebView.SetPreferences"; "web"; "logsPageMessagesToSystemConsoleEnabled"; 1 ) ]

Disable JavaScript:

MBS("WebView.SetPreferences"; $WebViewerRef; "javaScriptEnabled"; 0)

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 12nd February 2024


WebView.SetPageSizeMultiplier - WebView.SetPrintParameter

💬 Ask a question or report a problem