captureSelectedContentToDataPackageAsync method
Collapse the table of content
Expand the table of content

webview.captureSelectedContentToDataPackageAsync method

Applies to Windows and Windows Phone

Asynchronously gets a DataPackage that contains the selected content within the WebView.


var msWebViewAsyncOperation = webview.captureSelectedContentToDataPackageAsync();


This method has no parameters.

Return value

Type: MSWebViewAsyncOperation

An MSWebViewAsyncOperation object that, when it completes, provides a DataPackage object that contains the image. When using captureSelectedContentToDataPackageAsync, you need to define success and error handlers after defining the operation. After applying the event handlers, call the start method on the MSWebViewAsyncOperation object to execute the operation.

    var operation = webview.captureSelectedContentToDataPackageAsync();
    operation.oncomplete = function () {
        // operation.result is a package object that contains the selected data.
        var url = URL.createObjectURL(operation.result, { oneTimeOnly: true });
        // After converting the package to a URI, put it in an image element.
        document.getElementById('webviewPreview').src = url;


Minimum supported client

Windows 8.1 [desktop apps only]

Minimum supported server

Windows Server 2012 R2 [desktop apps only]

Minimum supported phone

Windows Phone 8.1

See also




© 2017 Microsoft