WebView.Create
--------------

Creates a new web view inside the window with the given rectangle.

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

MBS( "WebView.Create"; WindowRef; X; Y; W; H { ; Version; Flags } ) 

**MBS**( **"WebView.Create";** /\* Creates a new web view inside the window with the given rectangle. \*/  
**$WindowRef**; /\* Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window.e.g. 0 \*/   
**$X**; /\* The left coordinate in the window.e.g. 0 \*/   
**$Y**; /\* The top coordinate in the window.e.g. 0 \*/   
**$W**; /\* The width of the drop area in the window.e.g. 600 \*/   
**$H**; /\* The height of the drop area in the window.e.g. 400 \*/   
**$Version**; /\* Optional; The WebKit version you need.  
Pass 1 for WebKit 1.x or 2 for WebKit 2.x.  
Default is zero, which prefers WebKit 1 on MacOS.e.g. 0 \*/   
**$Flags**) /\* Optional; Pass 1 to allow triggering scripts from JavaScript.   
Pass 2 to allow FileMaker.Evaluate in JavaScript.  
Pass 3 to allow both.  
Default is 0.  
  
Mac only as not implemented for IE.e.g. 3 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| WindowRef | Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window. | 0 |  |
| X | The left coordinate in the window. | 0 |  |
| Y | The top coordinate in the window. | 0 |  |
| W | The width of the drop area in the window. | 600 |  |
| H | The height of the drop area in the window. | 400 |  |
| Version | The WebKit version you need.   Pass 1 for WebKit 1.x or 2 for WebKit 2.x.   Default is zero, which prefers WebKit 1 on MacOS. | 0 | Optional      Added in version **10.3**. |
| Flags | Pass 1 to allow triggering scripts from JavaScript.    Pass 2 to allow FileMaker.Evaluate in JavaScript.   Pass 3 to allow both.   Default is 0.      Mac only as not implemented for IE. | 3 | Optional      Added in version **16.2**. |

### Result

Returns webviewer reference number or error.

### Description

Creates a new web view inside the window with the given rectangle.  
If you create WebKit 1.x view, you can use all the PDF/Image rendering functions, download delegate and callback functions, which don't work in WebKit 2.x.  
But if you use WebKit 2.x, you can use script message handler or user scripts, which are not supported in WebKit 1.x.  
  
The view is released automatically when window closes.  
Web viewers created via WebView.Create or [WebView.CreateWithControl](WebViewCreateWithControl.md) are independent of FileMaker, so they don't reload with a record change. They also don't print with the layout and stay if you change the layout.  
  
Added iOS support in version 10.3 using WebKit 2.x.  
Added Windows support in version 10.3 using IE engine.  
  
Please call [WebView.Close](WebViewClose.md) later to close it.  
  
You can fmp: URLs and use FileMaker.PerformScript just like FileMaker's web viewer. For FileMaker.PerformScriptWithOption the option can be 1 for halt, 2 for exit, 3 for resume, 4 for pause. 0 is pause instead of continue and 6 is resume instead of Suspend and Resume since the plugin can't do these modes.  
  
e.g. trigger a script:  
  
FileMaker.PerformScript( "Script name", "Optional Parameter");  
  
You can use FileMaker.Evaluate to directly evaluate something from JavaScript. e.g. query a get function like this:  
  
let filename = await FileMaker.Evaluate('Get(FileName)');  
  
### Examples

Create WebView:

 Set Variable \[ $x ; Value: 40 \]   
Set Variable \[ $y ; Value: 80 \]   
Set Variable \[ $w ; Value: 970 \]   
Set Variable \[ $h ; Value: 440 \]   
  
Set Variable \[ $$web ; Value: MBS ("WebView.Create"; 0; $x ; $y ; $w ; $h ) \]   
Set Variable \[ $r ; Value: MBS ( "[WebView.LoadURL](WebViewLoadURL.md)"; $$web ; "https://www.mbsplugins.de/filemaker") \]  
Print via WebKit 1.x web viewer:

 # Create WebViewer Copy in file WebViewer Print   
  
\# Create web view in version 1 for WebKit   
Set Variable \[ $$web ; Value: MBS ("WebView.Create"; 0; 40; 80; 970; 440; 1) \]   
\# Load som eURL   
Set Variable \[ $r ; Value: MBS ( "[WebView.LoadURL](WebViewLoadURL.md)"; $$web ; "https://www.monkeybreadsoftware.com/filemaker/") \]   
\# wait for website to load   
Loop  
 Exit Loop If \[ MBS ( "[WebView.IsLoading](WebViewIsLoading.md)"; $$web ) ≠ 1 \]   
 Pause/Resume Script \[ Duration (seconds): ,1 \]   
End Loop  
\# set print parameters   
Set Variable \[ $r ; Value: MBS ("[WebView.SetPrintParameter](WebViewSetPrintParameter.md)"; "shouldPrintBackgrounds"; 0) \]   
Set Variable \[ $r ; Value: MBS ("[WebView.SetPrintParameter](WebViewSetPrintParameter.md)"; "leftMargin"; 30) \]   
Set Variable \[ $r ; Value: MBS ("[WebView.SetPrintParameter](WebViewSetPrintParameter.md)"; "topMargin"; 30) \]   
Set Variable \[ $r ; Value: MBS ("[WebView.SetPrintParameter](WebViewSetPrintParameter.md)"; "rightMargin"; 30) \]   
Set Variable \[ $r ; Value: MBS ("[WebView.SetPrintParameter](WebViewSetPrintParameter.md)"; "bottomMargin"; 30) \]   
\# get a file path   
Set Variable \[ $Path ; Value: MBS ( "[Path.AddPathComponent](PathAddPathComponent.md)"; MBS ( "[Folders.UserDesktop](FoldersUserDesktop.md)" ); "test.pdf") \]   
\# print to PDF   
Set Variable \[ $r ; Value: MBS ("[WebView.PrintToFile](WebViewPrintToFile.md)"; $$web ; $Path ) \]  
### See also

- [Preview.Create](PreviewCreate.md)
- [WebView.PrintToFile](WebViewPrintToFile.md)
- [WebView.RenderImage](WebViewRenderImage.md)
- [WebView.RunJavaScript](WebViewRunJavaScript.md)
- [WebView.SearchText](WebViewSearchText.md)
- [WebView.SetPreferences](WebViewSetPreferences.md)
- [WebView.Version](WebViewVersion.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)
- [Window.SetCloseTrigger](WindowSetCloseTrigger.md)

### Release notes

- **Version 16.3**
    - Added flag 4 for WebView.CreateWindow function to make the window a floating palette.
- **Version 16.2**
    - Added [WebView.CreateWindow](https://www.mbsplugins.eu/WebViewCreateWindow.shtml) function.
    - Added flags parameter for [Overlay.AddWebViewer](https://www.mbsplugins.eu/OverlayAddWebViewer.shtml), [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml), [WebView.CreateWindow](https://www.mbsplugins.eu/WebViewCreateWindow.shtml) and [WebView.CreateWithControl](https://www.mbsplugins.eu/WebViewCreateWithControl.shtml) functions to control whether script triggers or Evaluate are allowed.
- **Version 12.5**
    - Fixed a problem with restoring custom WebViewers with [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml).
- **Version 11.3**
    - Changed web viewer made with [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) using WebKit 1 to output alert() as log messages to Console.app.
- **Version 10.5**
    - Fixed memory leaks in [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) on Windows and [WebView](https://www.mbsplugins.eu/component_WebView.shtml) functions.
    - Fixed problem with [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) creating two web viewers with parameter zero.
- **Version 10.3**
    - Added Windows support for [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) using IE engine.
    - Added version parameter for [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) to pick WebKit 2 and added iOS support.
    - Added [WebView.CreateWithControl](https://www.mbsplugins.eu/WebViewCreateWithControl.shtml) and [WebView.SetFrameWithControl](https://www.mbsplugins.eu/WebViewSetFrameWithControl.shtml) functions.
    - Deprecated [DragDrop.CreateOnPopoverWithControl](https://www.mbsplugins.eu/DragDropCreateOnPopoverWithControl.shtml), [DragDrop.CreateOnPopoverWithSize](https://www.mbsplugins.eu/DragDropCreateOnPopoverWithSize.shtml), [TextView.CreateOnPopoverWithControl](https://www.mbsplugins.eu/TextViewCreateOnPopoverWithControl.shtml), [TextView.CreateOnPopoverWithSize](https://www.mbsplugins.eu/TextViewCreateOnPopoverWithSize.shtml) and [WebView.CreateOnPopover](https://www.mbsplugins.eu/WebViewCreateOnPopover.shtml) functions.
    - Rewrote control placement for MacOS and iOS controls for [AVPlayer.AddView](https://www.mbsplugins.eu/AVPlayerAddView.shtml), [DragDrop.CreateWithControl](https://www.mbsplugins.eu/DragDropCreateWithControl.shtml), [ImageView.CreateWithControl](https://www.mbsplugins.eu/ImageViewCreateWithControl.shtml), [MapView.CreateWithControl](https://www.mbsplugins.eu/MapViewCreateWithControl.shtml), [TextView.CreateWithControl](https://www.mbsplugins.eu/TextViewCreateWithControl.shtml), [WebView.CreateWithControl](https://www.mbsplugins.eu/WebViewCreateWithControl.shtml).
    - Rewrote parts of [AVRecorder.AddPreviewToWindow](https://www.mbsplugins.eu/AVRecorderAddPreviewToWindow.shtml) and [WebView.Create](https://www.mbsplugins.eu/WebViewCreate.shtml) for Mac/iOS to work better. Positioning is now relative to top/left of FileMaker content.
- **Version 9.1**
    - Changed web viewer made with [WebView.Create](http://www.mbsplugins.eu/WebViewCreate.shtml) to open links with target=\_blank in browser.
- **Version 8.1**
    - Added [WebView.CreateOnPopover](http://www.mbsplugins.eu/WebViewCreateOnPopover.shtml) function.
- **Version 7.5**
    - Changed [WebView.InstallCallback](http://www.mbsplugins.eu/WebViewInstallCallback.shtml) to work in FMP 16 with [WebView.Create](http://www.mbsplugins.eu/WebViewCreate.shtml).

### Example Databases

- [WebViewer/Custom WebView](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/WebViewer/Custom%20WebView.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS Plugin 16.2 for Claris FileMaker](https://www.mbsplugins.de/archive/2026-05-05/MBS_Plugin_162_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.2pr3](https://www.mbsplugins.de/archive/2026-04-17/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [WebViewer or not?](https://www.mbsplugins.de/archive/2025-02-15/WebViewer_or_not/monkeybreadsoftware_blog_filemaker)
- [Working on WebViewer memory leaks](https://www.mbsplugins.de/archive/2020-11-09/Working_on_WebViewer_memory_le/monkeybreadsoftware_blog_filemaker)
- [What is new in the MBS FileMaker Plugin Version 10.3](https://www.mbsplugins.de/archive/2020-07-31/What_is_new_in_the_MBS_FileMak/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 10.3 - More than 6200 Functions In One Plugin](https://www.mbsplugins.de/archive/2020-07-21/MBS_FileMaker_Plugin_103_-_Mor/monkeybreadsoftware_blog_filemaker)
- [Web viewer exists only with URL loaded](https://www.mbsplugins.de/archive/2019-08-27/Web_viewer_exists_only_with_UR/monkeybreadsoftware_blog_filemaker)
- [Trigger FileMaker Scripts from JavaScript in FileMaker 16](https://www.mbsplugins.de/archive/2017-12-15/Trigger_FileMaker_Scripts_from/monkeybreadsoftware_blog_filemaker)
- [Print WebViewer on macOS in FileMaker](https://www.mbsplugins.de/archive/2017-11-28/Print_WebViewer_on_macOS_in_Fi/monkeybreadsoftware_blog_filemaker)
- [Custom WebView in FileMaker 16](https://www.mbsplugins.de/archive/2017-08-26/Custom_WebView_in_FileMaker_16/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 26th August 2017 , last changed 17th April 2026

  
[WebView.CopyFormattedText](WebViewCopyFormattedText.md) - [WebView.CreateWindow](WebViewCreateWindow.md)

[HTML Version](WebViewCreate.shtml)