FileMaker and WebViewer communication

Document created by monkeybreadsoftware on Aug 24, 2018Last modified by monkeybreadsoftware on Aug 24, 2018
Version 2Show Document
  • View in full screen mode

A lot of FileMaker developers love to interact with WebViewer. There are a couple of ways to move data in/out or call back to FileMaker. For a few things our MBS FileMaker Plugin can help a lot.

Here an overview:

 

Load webpage into WebViewer:

  • Use FileMaker's Set Webviewer Script Step to pass in URL with content.
    This is limited to a few thousand characters and URL may get logged.
  • Write local HTML file and call Set Webviewer Script step with an URL pointing to the file. Path.FilePathToFileURL may help here.
  • Use WebView.LoadHTML in MBS Plugins to load HTML from text in variable or field.
  • Use WebView.LoadURL to load URL.
    Pass for Mac and iOS the cache policy and the timeout value.

 

Calling

  • You can use MBS Plugin WebView.RunJavaScript which will pass the javascript to run. For Mac and iOS, this function returns the result, while on Windows, we can't get the result.
  • Use WebView.RunJavaScriptReturnTitle which is designed to return the title of the document. In JavaScript you can put result in document.title and we pass it back. This may not work well with line breaks.

 

Pass data to

 

Trigger Script from

  • Use fmp URL to trigger a script. May run the wrong version of FileMaker.
  • Use Webview.AddScriptMessageHandler to trigger script from JavaScript for FileMaker 16 and newer with Mac & iOS
  • Use WebView.InstallCallback to trigger script for FileMaker 15 and earlier on Mac and Windows with IE 9 or older.
  • Use ServerSocket.Start to listen to requests and send HTTP Request via XMLHttpRequest in JavaScript.
  • Use Data API on FileMaker Server via requests sent from JavaScript.

 

Pass back data from

 

If you know more to add here, please comment or email us.

3 people found this helpful

Attachments

    Outcomes