WebView.RunJavaScriptReturnTitle
--------------------------------

Run the specified JavaScript and then returns the value of the title property to FileMaker.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [WebView](component_WebView.md) | [1.4](newinversion14.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |

MBS( "WebView.RunJavaScriptReturnTitle"; WebViewerRef; JavaScript ) 

**MBS**( **"WebView.RunJavaScriptReturnTitle";** /\* Run the specified JavaScript and then returns the value of the title property to FileMaker. \*/  
**$WebViewerRef**; /\* Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. \*/   
**$JavaScript**) /\* the text source of the javascript \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| WebViewerRef | Either the Web Viewer Object Name or the Web Viewer ID as returned by "[WebView.FindByName](WebViewFindByName.md)" function. |  |
| JavaScript | the text source of the javascript |  |

### Description

Run the specified JavaScript and then returns the value of the title property to FileMaker.   
To return a result of the JavaScript to FileMaker, simply set "document.title" to the return value. Why did we do this? Because it was the way we could get the result back from the web view on windows. Use "\\n" in javascript strings for a newline character.  
  
See newer [WebView.Evaluate](WebViewEvaluate.md) function which works better on Windows and returns results.  
Check JS Functions for JavaScript engine for cross platform code to run without web viewer.  
  
For Windows with Edge browser or Web Direct, you may use the Perform JavaScript script step in FileMaker 19 instead.  
### Examples

Return the htmlcode of a field as string:

 MBS ( "WebView.RunJavaScriptReturnTitle"; "browser"; "document.title=document.getElementById('td\_ProcName\_v').innerHTML;" )  
Return the text of a html item referenced by id as string:

 MBS ( "WebView.RunJavaScriptReturnTitle"; "browser"; "document.title=document.getElementById('Result').innerText;" )  
### See also

- [Text.RemoveNewLine](TextRemoveNewLine.md)
- [WebView.Evaluate](WebViewEvaluate.md)
- [WebView.FindByName](WebViewFindByName.md)
- [WebView.RunJavaScript](WebViewRunJavaScript.md)

### Example Databases

- [WebViewer/Form Fields/Forms Sample](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Form%20Fields/Forms%20Sample.shtml#25ScriptAnchor_)

### Blog Entries

- [FileMaker and WebViewer communication](https://www.mbsplugins.de/archive/2018-08-24/FileMaker_and_WebViewer_commun/monkeybreadsoftware_blog_filemaker)
- [Mapping addresses to geo coordinates](https://www.mbsplugins.de/archive/2011-12-15/Mapping_addresses_to_geo_coord/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 24th June 2021

  
[WebView.RunJavaScript](WebViewRunJavaScript.md) - [WebView.Screenshot](WebViewScreenshot.md)

[HTML Version](WebViewRunJavaScriptReturnTitle.shtml)