Advertiser Monkeybreadsoftware Posted January 26, 2021 Advertiser Share Posted January 26, 2021 Did you know you can configure the capabilities of the WebViewer in FileMaker using MBS FileMaker Plugin functions?If you take a close look on the WebView.SetPreferences function for MacOS and iOS, you find a couple of options to set. Let's take a look on the most important options and what each option sets:minimumFontSizeYou may load some HTML into the web viewer, like the content of an email. Since you don't know the font sizes, you can define a minimum font size for the content. For example use 12 point for fonts as minimum:Set Variable [$r; Value: MBS("WebView.SetPreferences"; "web"; "minimumFontSize"; 12) ]javaScriptEnabledIf you show an email, it may be a good idea to disable JavaScript for the content. This avoids arbitrary HTML to include JavaScript, which may try and do network connections to track your user, trigger FileMaker scripts or exploit a JavaScript security problem.Disable JavaScript like this:Set Variable [$r; Value: MBS("WebView.SetPreferences"; "web"; "javaScriptEnabled"; 0) ]developerExtrasEnabledIn your scripts you can enable developer extras. This allows you to open the inspector via contextual mouse menus. As you can define this by script, you may want to enable it, if the current account privilege set is Full Access.You can enable developer extras like this:Set Variable [$r; Value: MBS("WebView.SetPreferences"; "web"; "developerExtrasEnabled"; 1) ] logsPageMessagesToSystemConsoleEnabledYou can enable logging console messages from a web page to the system console. First you enable the setting:Set Variable [ $r ; Value: MBS( "WebView.SetPreferences"; "web"; "logsPageMessagesToSystemConsoleEnabled"; 1 ) ] And then in JavaScript you can output to the console:Set Variable [$r; Value: MBS("WebView.RunJavaScript"; "web"; "console.log('Hello world!');") ]This shows in inspector and in Console.app you may look for messages and find something like this:15467 standard 21:58:14.818259+0100 com.apple.WebKit.WebContent https://www.mbs-plugins.com/:1:12: CONSOLE LOG Hello world!loadsImagesAutomaticallyWhen loading HTML you don't know about, it may refer to external images on some servers. By loading the images, you may reveal that you got the html and get tracked. This is often used for emails to track who received and opened the email. Disable loading images automatically:Set Variable [$r; Value: MBS("WebView.SetPreferences"; $WebViewerRef; "loadsImagesAutomatically", 0) ]telephoneNumberDetectionIsEnabledYou can define whether text detector should check the html shown and detect phone numbers. If phone numbers are found, they show like links, so the user can click on them to call. This is very useful when showing emails which may contain contact information.Enable phone number detection:Set Variable [$r; Value: MBS("WebView.SetPreferences"; $WebViewerRef; "telephoneNumberDetectionIsEnabled", 0) ]mediaStreamEnabled and mediaDevicesEnabledYou can allow media streaming for the web viewer. And you can allow media device access to camera, screen and microphone. Then you can use software for screen sharing and telephoning within FileMaker on recent macOS versions.See WebView.InstallUserMediaAccess function for details.webSecurityEnabled and CrossOriginResourcePolicyEnabledThis setting specifies whether browser should enforce same-origin policy. You can disable this in order to communicate with JavaScript between websites loaded from different servers.e.g. disable cross origin policy:Set Variable [$r; Value: MBS( "WebView.SetPreferences"; "web"; "CrossOriginResourcePolicyEnabled"; 0) ]Learn MoreCheck the other WebView functions. You may use WebView.EstimatedProgress to check progress and WebView.IsLoading to detect whether the website finished loading. Or you can use WebView.DisableJavascriptAlerts to disable the JavaScript alerts.For all Web Viewer you like to control via plugin, please make sure you have an URL loaded. Minimum would be "about:blank" for a white page. Until something is loaded, FileMaker defers creating the web viewer and the plugin can't find it.Please do not hesitate to contact us with your questions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.