In this sample today, we will see how to make use of WinJS.xhr for downloading image file from a remote URL. The WinJS.xhr wraps call to XMLHttpResponse in a promise. The promise is the abstraction provided over the available asynchronous operations. The call made using WinJS.xhr takes several parameters as below:
- type: represent HTTP method e.g. GET,POST etc.
- url: This is the mandatory parameter which represents the URL resource.
- user: User for authentication.
- Password: The Password.
- responseType: The expected response of the call made.
Note: We will use the following file to test the download. It is an image on a shared public DropBox folder (Image is CC licensed).