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
- canGoBack : bool
- canGoForward : bool
- loadProgress : int
- loading : bool
- title : string
- url : url
- userAgent : string
Signals
- loadingChanged(WebViewLoadRequest loadRequest)
Methods
- deleteAllCookies()
- goBack()
- goForward()
- loadHtml(string html)
- loadHtml(string html, url baseUrl)
- reload()
- runJavaScript(string script)
- runJavaScript(string script, var callback)
- stop()
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.
Name | Value |
---|---|
WebView.LoadStartedStatus | 0 |
WebView.LoadStoppedStatus | 1 |
WebView.LoadSucceededStatus | 2 |
WebView.LoadFailedStatus | 3 |
Property Documentation
Returns true if it's currently possible to navigate back in the web history. Otherwise, returns false.
Returns true if it's currently possible to navigate forward in the web history. Otherwise, returns false.
Returns the current load progress of the web content, represented as an integer between 0 and 100.
Returns true if the WebView is currently in the process of loading new content. Otherwise, returns false.
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.
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.
Note: The corresponding handler is onLoadingChanged
.
Method Documentation
Loads the specified html content to the web view.
The html parameter
The name of the HTML page to load.
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.
Runs the specified JavaScript.
runJavaScript("document.title",function (result) {console.log(result); })
The script parameter
The JavaScript command being run.
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.