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


Adds a script message handler.

Component Version macOS Windows Linux Server iOS SDK
WebView 8.0 ✅ Yes ❌ No ❌ No ❌ No ✅ Yes
MBS( "WebView.AddScriptMessageHandler"; WebViewerRef; Name )   More


Parameter Description Example
WebViewerRef Either the Web Viewer Object Name or the Web Viewer ID as returned by "WebView.FindByName" function.
Name The name of the message handler. "test"


Returns OK or error.


Adds a script message handler.
Adding a script message handler with name name causes the JavaScript function to be defined in all frames in all web views that use the user content controller.
Only for FileMaker 16 and newer.

Trigger script in FileMaker from JavaScript:

window.webkit.messageHandlers.test.postMessage({'filename':'WebView Message Handler.fmp12', 'parameter':'Hello World from JavaScript', 'scriptName':'test'});

Evaluate expression in JavaScript:

window.webkit.messageHandlers.test.postMessage({'evaluate':'MBS( "Msgbox"; "Hello from Evaluate in JavaScript" )'});

Added iOS for version 9.5.
New in version 10.3: If you pass "fm" as name, we connect the standard FileMaker handler, so you can restore it after you removed it earlier with WebView.RemoveScriptMessageHandler function.


Add script handler:

Set Variable [ $r ; Value: MBS( "Webview.AddScriptMessageHandler"; "web"; "test" ) ]

Restore FileMaker 19 handler:

Set Variable [ $r ; Value: MBS( "Webview.AddScriptMessageHandler"; "web"; "fm" ) ]

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 15th December 2017, last changed 4th June 2020

WebRequest.URLComponents - WebView.AddUserScript