Web content
You can use the WebView class to display dynamic web content in your app. You can display Internet content, HTML content provided in line in QML, or HTML content in the assets folder of your Cascades project. You simply supply a URL to WebView, and you can load a webpage in your app.
You can use the WebView class to view web documents. Each WebView object has an associated WebSettings object that you can reference to determine whether JavaScript, the Web Inspector, active text, or zoom are enabled. You can also set font sizes, style sheets, background colors, zoom settings, and more.

To change the appearance of the WebView, you can use any of the Control properties. You can change the size, margins, width, height, and more. If you use a root Container in your app, you can use its properties to limit the size of the webpage that you present.
After you set up a WebView, you can perform the following actions:
-
Check the progress of a webpage using the loading and loadProgress properties of WebView and the WebLoadRequest class. To learn more, see Monitoring webpage progress.
-
Determine the type of navigation that a user performs by using the navigationRequested() signal and the WebNavigationRequest class. To learn more, see Handling navigation on a webpage.
-
Search for text on a webpage in your app using the findText() function and the WebFindFlag class. To learn more, see Searching for text on a webpage.
-
Clear data, cookies, forms, credentials, databases, or caches using the WebStorage object associated with your WebView.
-
Store cookies in the WebCookieJar, which is an SQL database stored in the file system. To learn more, see Using cookies.
-
Let the user pinch to zoom in and out of content on a webpage using WebView and ScrollView settings, together with gesture handling. To learn more, see Adding gesture handling to your WebView.
-
Connect your WebView to other apps using your WebView settings and the invocation framework. To learn more, see Integrating a WebView with other apps.
-
Enable or disable JavaScript on your webpage using the javaScriptEnabled property, which is one of the WebSettings of WebView.
-
Inject JavaScript into your web content to change the appearance of your WebView or navigate to another webpage in your app using evaluateJavaScript(). You can use the JavaScriptWorld class to set the execution environment in which you want to run the JavaScript. To learn more, see Interacting with JavaScript.
-
Use the networking layer of the WebView for advanced control over resource requests that come from a webpage. To read more about web resources and filters, see WebResourceRequest and WebResourceRequestFilter.
You can learn more about WebView by visiting the links below.
Last modified: 2015-03-31