Version

Utility.URL.download

This method is used to download a resource from an URL, returning its file path for local use. The resource is stored locally, making it available when working offline.

Syntax

SPlus.Utility.URL.download (resourceUrl, useCache, function (filePath){
        //TODO: Implement what to do with filePath
}, function (errorResponse){
        var error = errorResponse['error#displayValue']; //Getting the error
        //TODO: Implement how to handle errors
}, function (cancelResponse){
        //TODO: Implement how to handle a user’s cancel
});

Utility.URL.donwload Parameters

Parameter

Type

Description

url

String

URL where the source is located

useCache

Boolean

Determines whether to search locally for the resource before downloading it or not. Using this parameter is very useful when you work offline.

onSuccess callback function

Parameter

Description

function (filePath)

Success callback function to be implemented, which received an Array with user profile properties (JavaScript Objects that contain three properties).

onError callback function

Parameter

Description

function (eResponse)

Error callback function to be implemented, which receives the eResponse JavaScript Object.

onCancel callback function

Parameter

Description

function (result)

Cancel callback function to be implemented.