Send Method

Executes a download request.

XAML
Cannot use methods in XAML.
Scripting
downloaderObject.Send()

Remarks

The Send method executes the request to download data using the Downloader object functionality. The Send method executes asynchronously. If you need to know the precise moment that the requested content is available, you should attach a handler for the Completed event prior to calling Send.

A cross-domain download attempt, or an attempt to download through the FILE scheme, will fail even before raising the Completed or DownloadFailed events, and the symptom of the failure is that the Send method call will fail.

Examples

The following JavaScript example shows how to invoke the Send method:

JavaScript
// Event handler for initializing and executing a download request.
function onMouseLeftButtonUp(sender, eventArgs)
{
    // Retrieve a reference to the plug-in.
    var slPlugin = sender.getHost();
    // Create a Downloader object.
    var downloader = slPlugin.createObject("downloader");
    // Add DownloadProgressChanged and Completed events.
    downloader.addEventListener("downloadProgressChanged", onDownloadProgressChanged);
    downloader.addEventListener("completed", onCompleted);
    // Initialize the Downloader request.
    // NOTE: downloader APIs disallow file:\\ scheme
    // you must run this sample over localhost: or off a server or the following call will fail
    downloader.open("GET", "promo.png");
    // Execute the Downloader request.
    downloader.send();
}

Applies To

Downloader

See Also

Using a Downloader Object
Abort
Open