Topics   All   MacOS (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Deprecated   Guides   Examples   Videos
New in version: 11.4   11.5   12.0   12.1   12.2   12.3   12.4   12.5   13.0   13.1    Statistic    FMM    Blog  


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

Blog Entries

This function checks for a paid license.

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

WebRequest.URLComponents - WebView.AddUserScript

💬 Ask a question or report a problem

Start Chat