# Download Files

{% tabs %}
{% tab title="Ios" %}
You need to append "wtn-download-file=true" in query parameter.

```
<a href="download-url?wtn-download-file=true"> download File</a>
or 
window.location.href = "download-url?wtn-download-file=true";
```

{% endtab %}

{% tab title="Android" %}
For Android you don't need to do any extra handling. it will work for App if it works for Browser.
{% endtab %}
{% endtabs %}

In iOS For blob files download

{% tabs %}
{% tab title="iOS" %}
You need to append "filename=your-file-name.extension" in query parameter.

```
For example 
For video - blob:https://video_url?filename="abc.mp4"
For image - blob:https://image_url?filename="myImage.png"
For pdf - blob:https://pdf_url?filename="document.pdf"
```

{% endtab %}
{% endtabs %}

Blob feature added on 03/11/2023

Additonal Support for iOS Blob Download

{% tabs %}
{% tab title="iOS" %}
Alternate method

```html
You'll need to import the javascript file in your website.

<script src="https://unpkg.com/webtonative@1.0.89/webtonative.min.js"></script>

window.WTN.downloadBlobFile({
    fileName:"your_file_name.pdf",
    downloadUrl:link_to_the_file,    
    shareFileAfterDownload: true,
    openFileAfterDownload: false
})

Pass the filename and blob file url for example - blob:https://pdf_url
shareFileAfterDownload - Opens the share option
openFileAfterDownload - opens the file in a window inside app

Function added on 06/08/2024
Function updated on 02/02/2026
```

{% endtab %}
{% endtabs %}

Additional Support for Android File Download

{% tabs %}
{% tab title="Android" %}

```
You'll need to import the javascript file in your website.

<script src="https://unpkg.com/webtonative@1.0.58/webtonative.min.js"></script>

window.WTN.customFileDownload({
    fileName:"your_file_name.pdf",
    downloadUrl:line_to_the_file
    mimeType:"application/pdf",
    cookies:"",
    isBlob:false,
    userAgent:"",
    openFileAfterDownload:true
})

Pass the filename and blob file url for example - blob:https://pdf_url

Function added on 12/09/2024
```

{% endtab %}
{% endtabs %}

fileName - The desired file name for download

downloadUrl - Link to the file download location

mimeType (optional) - The download file mimeType to support opening the file in respective application and have proper extension while download

cookies (optional) - To pass any user cookies for downloading

isBlob (optional) - Boolean value, to specify if download method uses blob fle download

userAgent (optional) - To customise the userAgent while downloading

openFileAfterDownload (optional) -  Boolean Value, to open the file after it has been successfully downloaded, it is compulsory to pass fileName and mimeType for this to work when setting it true.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.webtonative.com/javascript-apis/download-files.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
