Download Files

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";

In iOS For blob files download

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"

Blob feature added on 03/11/2023

Additonal Support for iOS Blob Download

Alternate method

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

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

window.WTN.downloadBlobFile({
    fileName:"your_file_name.pdf",
    downloadUrl:line_to_the_file
})

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

Function added on 06/08/2024

Additional Support for Android File Download

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

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.

Last updated