webview.capturePreviewToBlobAsync method

Applies to Windows and Windows Phone

Creates an image of the current webview element and write it to the specified image element.

Syntax


var msWebViewAsyncOperation = webview.capturePreviewToBlobAsync();

Parameters

This method has no parameters.

Return value

Type: MSWebViewAsyncOperation

An MSWebViewAsyncOperation object that, when it completes, provides a Blob object that contains the image. When using capturePreviewToBlobAsync, 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.capturePreviewToBlobAsync();
    operation.oncomplete = function () {
        // operation.result is a blob that contains the preview image.
        var url = URL.createObjectURL(operation.result, { oneTimeOnly: true });
        // After converting the blob to a URI, put it in an image element.
        document.getElementById('webviewPreview').src = url;
    };
    operation.start();  

Requirements

Minimum supported client

Windows 8.1 [Windows Store apps only]

Minimum supported server

Windows Server 2012 R2 [Windows Store apps only]

Minimum supported phone

Windows Phone 8.1

See also

webview

 

 

Показ:
© 2015 Microsoft