WebView QML Type

The WebView component displays web content using platform native APIs if available. This avoids using a full web browser stack into your application. More...

Import Statement: import ArcGIS.AppFramework.WebView 1.0

Properties

Signals

Methods

Detailed Description

The WebView component currently supports enterprise logins on mobile platforms, in which the web page may have HTTP Basic Authentication, Windows Authentication or SAML/ADFS. This means that WebView can authenticate to ArcGIS Online or Portal for ArcGIS on iOS and Android devices. A login prompt is displayed for users to enter the username and password. Once the credentials are entered into the displayed login prompt, AppFramework WebView resubmits the request to the same URL with the credential information.

The AppFramework WebView component is extended from Qt's WebView component, and supports all functions of the original component. http://doc.qt.io/qt-5/qml-qtwebview-webview.html

App {
    id: app
    width: 400
    height: 640

    WebView {
        anchors.fill: parent
        url: "http://appstudio.arcgis.com"

    }
}

Enumerations

LoadStatus enumeration

This enum describes the load status of a page.

NameValue
WebView.LoadStartedStatus0
WebView.LoadStoppedStatus1
WebView.LoadSucceededStatus2
WebView.LoadFailedStatus3

Property Documentation

[read-only] canGoBack : bool

Returns true if it's currently possible to navigate back in the web history. Otherwise, returns false.


[read-only] canGoForward : bool

Returns true if it's currently possible to navigate forward in the web history. Otherwise, returns false.


[read-only] loadProgress : int

Returns the current load progress of the web content, represented as an integer between 0 and 100.


[read-only] loading : bool

Returns true if the WebView is currently in the process of loading new content. Otherwise, returns false.


[read-only] title : string

Returns the title of the currently loaded web page.


url : url

The URL of currently loaded web page. Changing this will trigger loading new content.

The URL is used as-is. URLs that originate from user input should be parsed with the QUrl method fromUserInput, provided by the Qt Core.


userAgent : string

Returns the user agent given to a web address. A user agent is software acting on behalf of the user, and in this case declares a web browser to the target website.


Signal Documentation

loadingChanged( WebViewLoadRequest loadRequest)

Signal emitted when the loading state of the web content changes.

The loadRequest parameter holds the URL and status of the requests, as well as an error string containng an error message for a failed request.


Method Documentation

deleteAllCookies()


goBack()

Navigates back in the web history.


goForward()

Navigates forward in the web history.


loadHtml(html)

Loads the specified html content to the web view.

The html parameter

The name of the HTML page to load.


loadHtml(html, url baseUrl)

Loads the specified HTML content to the web view.

This method offers a lower-level alternative to the url property, which references HTML pages via URL.

External objects such as stylesheets or images referenced in the HTML document should be located relative to baseUrl. For example, if html is retrieved from http://www.example.com/documents/overview.html, which is the base URL, then an image referenced with the relative url, diagram.png, should be at http://www.example.com/documents/diagram.png.

Note that WebView doesn't support loading content through the Qt Resource system.

The html parameter

The name of the HTML page to load.

The baseUrl parameter

The base address to load the URL from.


reload()

Reloads the current URL.


runJavaScript(script)

Runs the specified JavaScript.

runJavaScript("document.title",function (result) {console.log(result); })

The script parameter

The JavaScript command being run.


runJavaScript(script, var callback)

Run the specified JavaScript. In the event that a callback function is provided, it will be invoked after the script has finished running.

The script parameter

The JavaScript command being run.

The callback parameter

The callback function invoked after the script has finished.


stop()

Stops loading the current web page.