captureSelectedContentToDataPackageAsync method

webview.captureSelectedContentToDataPackageAsync method

Applies to Windows and Windows Phone

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

Syntax


var msWebViewAsyncOperation = webview.captureSelectedContentToDataPackageAsync();

Parameters

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;
    };
    operation.start();  

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1

See also

webview

 

 

Afficher:
© 2016 Microsoft