Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
WebView.Create
Creates a new web view inside the window with the given rectangle.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
WebView | 7.4 | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
WindowRef | Window Reference is the unique OS level window ID. You can obtain this by using the Window.FindByTitle or Window.FindByIndex 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 | Available in MBS FileMaker Plugin 10.3 or newer. 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 |
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 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 later to close it.
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"; $$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"; $$web; "https://www.monkeybreadsoftware.com/filemaker/") ]
# wait for website to load
Loop
Exit Loop If [ MBS( "WebView.IsLoading"; $$web ) ≠ 1 ]
Pause/Resume Script [ Duration (seconds): ,1 ]
End Loop
# set print parameters
Set Variable [ $r ; Value: MBS("WebView.SetPrintParameter"; "shouldPrintBackgrounds"; 0) ]
Set Variable [ $r ; Value: MBS("WebView.SetPrintParameter"; "leftMargin"; 30) ]
Set Variable [ $r ; Value: MBS("WebView.SetPrintParameter"; "topMargin"; 30) ]
Set Variable [ $r ; Value: MBS("WebView.SetPrintParameter"; "rightMargin"; 30) ]
Set Variable [ $r ; Value: MBS("WebView.SetPrintParameter"; "bottomMargin"; 30) ]
# get a file path
Set Variable [ $Path ; Value: MBS( "Path.AddPathComponent"; MBS( "Folders.UserDesktop" ); "test.pdf") ]
# print to PDF
Set Variable [ $r ; Value: MBS("WebView.PrintToFile"; $$web; $Path) ]
See also
- Preview.Create
- WebHook.Create
- WebView.LoadURL
- WebView.Release
- WebView.RenderImage
- WebView.RunJavaScript
- WebView.SearchText
- WebView.Version
- Window.FindByIndex
- Window.SetCloseTrigger
Release notes
- Version 12.5
- Fixed a problem with restoring custom WebViewers with WebView.Create.
- Version 11.3
- Changed web viewer made with WebView.Create using WebKit 1 to output alert() as log messages to Console.app.
- Version 10.5
- Fixed memory leaks in WebView.Create on Windows and WebView functions.
- Fixed problem with WebView.Create creating two web viewers with parameter zero.
- Version 10.3
- Added Windows support for WebView.Create using IE engine.
- Added version parameter for WebView.Create to pick WebKit 2 and added iOS support.
- Added WebView.CreateWithControl and WebView.SetFrameWithControl functions.
- Deprecated DragDrop.CreateOnPopoverWithControl, DragDrop.CreateOnPopoverWithSize, TextView.CreateOnPopoverWithControl, TextView.CreateOnPopoverWithSize and WebView.CreateOnPopover functions.
- Rewrote control placement for MacOS and iOS controls for AVPlayer.AddView, DragDrop.CreateWithControl, ImageView.CreateWithControl, MapView.CreateWithControl, TextView.CreateWithControl, WebView.CreateWithControl.
- Rewrote parts of AVRecorder.AddPreviewToWindow and WebView.Create 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 to open links with target=_blank in browser.
- Version 8.1
- Added WebView.CreateOnPopover function.
- Version 7.5
- Changed WebView.InstallCallback to work in FMP 16 with WebView.Create.
- Version 7.4
- Added Webview.Create function to create WebKit 1.x views to create PDFs/Images from website in FileMaker 16.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 12.5pr5
- MBS FileMaker Plugin, version 11.3pr3
- Working on WebViewer memory leaks
- What is new in the MBS FileMaker Plugin Version 10.3
- MBS FileMaker Plugin 10.3 - More than 6200 Functions In One Plugin
- Web viewer exists only with URL loaded
- Trigger FileMaker Scripts from JavaScript in FileMaker 16
- Print WebViewer on macOS in FileMaker
- MBS FileMaker Plugin 7.4 - More than 4900 Functions In One Plugin
- Custom WebView in FileMaker 16
This function checks for a license.
Created 26th August 2017, last changed 25th January 2024