Skip to content

TTMSFMXNativeUIWebView

Usage

You use the TMSFMXNativeUIWebView class to embed web content in your application.

Published Properties

Properties name Description
ScalesPageToFit Scales the page to fit the size of the WebView.

Public Properties

Properties name Description
WebView Returns a reference to the native iOS UIWebView.

Public Methods

Methods name Description
CanGoBack: Boolean; Returns a Boolean if the WebView can go back.
CanGoForward: Boolean; Returns a Boolean if the WebView can go forward.
ExecuteJavaScript(AScript: String): String; Executes Javascript on the current page.
GoBack; Goes back one page in the WebView.
GoForward; Goes forward one page in the WebView.
isLoading: Boolean; Returns a Boolean whether the WebView is loading or not.
LoadFile(AFile: String); Loads a specific file inside the WebView.
LoadHTMLString(AHTML: String); Loads a specific HTML string or HTML content inside the WebView.
Navigate(AURL: String); Navigates to a specific URL.
Reload; Reloads the current page.
StopLoading; Stops loading the current page.

Published Events

Events name Description
OnDidFailLoadWithError Event called when the loading failed.
OnDidFinishLoad Event called when the loading is finished.
OnDidStartLoad Event called when the loading started.
OnShouldStartLoadWithRequest Event called when the WebView should start loading with a specific request.

Executing Javascript

The WebView has a function ExecuteJavaScript that executes javascript code on the current page. The following code will show an alert dialog with a “Hello World” message:

TMSFMXNativeUIWebView1.ExecuteJavaScript('alert("Hello World");');

Loading HTML

Other than loading a page through an URL, the WebView can also display HTML from a string. The LoadHTMLString functionality loads the HTML tags / content and displays the HTML inside the WebView.