Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.2   7.3   7.4   7.5   8.0   8.1   8.2   8.3   8.4   8.5    Statistic  

Webview.AddScriptMessageHandler

Adds a script message handler.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Webview 8.0 Yes No No No No

MBS( "Webview.AddScriptMessageHandler"; Name )

Parameters

Parameter Description Example value
Name The name of the message handler. "test"

Result

Returns OK or error.

Description

Adds a script message handler.
Adding a script message handler with name name causes the JavaScript function window.webkit.messageHandlers.name.postMessage(messageBody) 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" )'});

Examples

Add script handler:

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

See also

Example Databases

Created 15th December 2017, last changed 15th December 2017


WebView.zoomPageOut   -   Webview.AllCookies

Feedback: Report problem or ask question.




Links
MBS Xojo PDF Plugins