webview element | webview object

Displays HTML content in an app.
Syntax
var webview = document.createElement("x-ms-webview");
DOM Information
Inheritance Hierarchy
Members
The webview object has these types of members:
Events
The webview object has these events.
| Event | Description |
|---|---|
| MSWebViewContentLoading |
Indicates that the HTML content is downloaded and is being loaded into the control. |
| MSWebViewDOMContentLoaded |
Indicates that the main DOM elements have finished loading. |
| MSWebViewFrameContentLoading |
Indicates that the HTML content downloaded and is being loaded into the <iframe> control. |
| MSWebViewFrameDOMContentLoaded |
Indicates that the main DOM elements have finished loading in the <iframe>. |
| MSWebViewFrameNavigationCompleted |
Indicates the navigation is complete, and all media elements are rendered in the <iframe>. |
| MSWebViewFrameNavigationStarting |
Indicates a <iframe> within a WebView is starting to navigate. |
| MSWebViewNavigationCompleted |
Indicates the navigation is complete, and all media elements are rendered. |
| MSWebViewNavigationStarting |
Indicates the WebView is starting to navigate MSWebViewContentLoading The HTML content is downloaded and is being loaded into the control. |
| MSWebViewNewWindowRequested |
Raised when content in WebView is trying to open a new window. |
| MSWebViewPermissionRequested |
Indicates that content in the WebView is trying to access functionality (such as geolocation, or pointer lock access) that normally requires end-user permissions. |
| MSWebViewScriptNotify |
Raised when a page inside the WebView element calls the window.external.notify method. |
| MSWebViewUnsupportedUriSchemeIdentified |
Raised when there is navigation to an Uniform Resource Identifier (URI) that WebView does not support. |
| MSWebViewUnviewableContentIdentified |
Raised when the WebView cannot find the content. |
Methods
The webview object has these methods.
| Method | Description |
|---|---|
| addWebAllowedObject |
Adds a native Windows Runtime object as a global parameter to the top-level document inside of a WebView. |
| buildLocalStreamUri |
Creates a URI that you can pass to navigateToLocalStreamUri. |
| capturePreviewToBlobAsync |
Creates an image of the current webview element and write it to the specified image element. |
| captureSelectedContentToDataPackageAsync |
Asynchronously gets a DataPackage that contains the selected content within the WebView. |
| getDeferredPermissionRequestById |
Returns the specified deferred permission request. |
| getDeferredPermissionRequests |
Returns a list of deferred permission requests issued by content in the WebView control. |
| goBack |
Navigates the WebView to the previous page in the navigation history. |
| goForward |
Navigates the WebView to the next page in the navigation history. |
| invokeScriptAsync |
As an asynchronous action, executes the specified script function from the currently loaded HTML, with specific arguments. |
| navigate |
Loads the HTML content at the specified URI. |
| navigateToLocalStreamUri |
Loads local web content at the specified URI using an IUriToStreamResolver. |
| navigateToString |
Loads the specified HTML content as a new document. |
| navigateWithHttpRequestMessage |
Navigates the webview to a URI with a POST request and HTTP headers. |
| refresh |
Reloads the current content in the WebView. |
| stop |
Halts the current WebView navigation or download. |
Properties
The webview object has these properties.
| Property | Access type | Description |
|---|---|---|
|
Read-only |
Gets a value that indicates whether the WebView can navigate backward. | |
|
Read-only |
Gets a value that indicates whether the WebView can navigate forward. | |
|
Read-only |
Gets the title of the page currently displayed in the WebView. | |
|
Read/write |
Gets or sets the height of the WebView. | |
|
Read/write |
Gets or sets the URI source of the HTML content to display in the WebView control. | |
|
Read/write |
Gets or sets the width of the WebView. |
Remarks
When a Windows app using JavaScript is printed, the <x-ms-webview> tags are transformed into <iframe> tags before printing. Besides the normal difference between displaying on screen and rendered for print, CSS styles applied to <iframe> elements are then applicable to the <iframe> transformed from <x-ms-webview>.
For more information, see the HTML WebView control sample.
AppCache storage limitations
Applications using JavaScript support of the Application Cache API (or AppCache), as defined in the HTML5 specification, to create offline web applications must observe available storage limitations. This is especially true in devices with limited memory space. The practical limits on the size of the AppCache are always a function of available disk storage space. The general guidelines are shown below.
| Volume size | AppCache per domain | AppCache per user |
|---|---|---|
| up to 4GB | 10MB | 50MB |
| 4GB to 16GB | 50MB | 500MB |
| 16GB to 32 GB | 50MB | 1GB |
All Windows 10 apps are intended to use the same AppCache quota model, so the available disk storage limitation applies to both desktop and phone apps. The is also a hard limit after pages loaded inside WebView together have consumed 1 GB of AppCache space; requests for additional AppCache storage above this limit will be denied.
See also