WebToNative
  • Getting started
  • Plugin Setup
    • OneSignal Set Up
    • Google AdMob Setup
    • In App Purchase - iOS Setup
    • In App Purchase - Android Setup
    • Firebase Notification Integration - iOS Setup
  • Social Login Integrations
    • Getting the SHA Key for Google Login
    • Create Google OAuth Client Id
    • Facebook Login Configuration
  • Javascript APIS
    • Getting Started
    • Status Bar
    • Pull To Refresh
    • Close App
    • Device Info
    • Clear App Cache
    • OneSignal Push Notification
    • Download Files
    • Printing Options
    • AdMob
    • Geo Location
    • Load In External Browser
    • Barcode Scan
    • In App Purchase - iOS Integration
    • In App Purchase - Android Integration
    • Social Login
    • Facebook App Events
    • Bottom Navigation
    • Clipboard
    • Screen Control
    • Background Location
    • Native Contacts
    • iOS App Tracking Transparency
    • Google Firebase Analytics
    • Haptic Feedback
    • Google Firebase Notification
    • Apps Flyer
    • App Review
    • Calender - iOS
    • Calendar - Android
    • Biometric Authentication
    • Media Player
    • Notification View
    • Offer Card
    • Cookie Update
    • App Launch Detection
    • Download Manager
    • Dynamic App Icon
    • File Sharing
  • Website Plugins
    • Wordpress
      • Push notification (WooCommerce)
      • In-App Purchase
        • In-App Purchase (IAP) Configuration Guide for iOS and Android
        • In-App Purchase (WooCommerce)
        • In-App Purchase
      • Offercard
      • Biometric Authentication
      • Social Login
      • Webtonative media player
        • WebToNative Radio Player
        • MediaPlayer Native Control
    • Bubble.io
      • Customize Status Bar
      • Device-Based Element Visibility
      • Pull to Refresh (Android)
      • OneSignal Push Notification
        • Set External ID
        • Send Push Notification
        • Set/Remove Email or SMS Phone
        • Set Tag
      • Close App
      • Get Device Info
      • Clear App Cache (Android)
      • Screen Control
      • Facebook Events
        • Regular
        • Purchase
      • AdMob
      • Offercard
      • In-App Purchase
        • In-App Purchase (Android/iOS)
        • Get IAP Canceled Subscription List (iOS)
      • Social Login
      • Biometric Authentication
  • Shopify
    • Social Login
    • In-App Purchase
      • In-app purchase
    • Push Notification
      • Abandoned Cart
    • Status Bar Customization
    • Native Device Visibilty
    • Set Onesignal Tags
    • Pull to Refresh
    • Account Deletion
    • Biometric Authentication
  • Upload Apps
    • Android App
    • Ios App
Powered by GitBook
On this page

Was this helpful?

  1. Javascript APIS

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

For Android you don't need to do any extra handling. it will work for App if it works for Browser.

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.

PreviousOneSignal Push NotificationNextPrinting Options

Last updated 8 months ago

Was this helpful?