Skip to content

Guides

WebView Download Not Working? PDF and Invoice Buttons in a Website App

A download button that works in Chrome can do nothing inside your app. Here is how to tell which kind of download you have, which side has to fix it and what to test on a phone.

10 min read

A WebView download is not working, usually, because Android's WebView does not save files by itself: it only notifies the app, and the app has to do the downloading. If the button builds the file in the browser (a blob: or data: link), the app also needs extra code, because Android's standard download manager accepts only HTTP or HTTPS addresses. So the fix is in the app, in how your site delivers the file, or both.

Why is a WebView download not working when Chrome works?

Chrome is a full browser with its own download handling. A website app shows your pages inside a component called WebView. When WebView meets something that should be downloaded, it calls the app's DownloadListener and passes along the file's address, the user agent, the Content-Disposition header, the file type and the reported size. What happens next depends entirely on what the app's code does with that notice.

That is why the symptom is often silent: you tap Download invoice and no file, message or error appears. Editing the button's design will not change this. Uploads have a similar split between browser and app, covered in WebView file upload not working.

Which kind of download link does my site use?

This is the question to answer before contacting anyone. Open your site in a desktop browser, right-click the button and choose Inspect, or copy the link address. Then match what you find to a row below.

Four kinds of download and what each needs inside an Android app (checked November 2026)
What you seeTypical exampleWhat it needs in the appWhat you can change on your site
An https:// link to a public fileA price list or menu PDFA download listener that hands the address to a downloaderSend a clear file name and file type
An https:// link that works only when signed inAn invoice in a customer accountThe download request must carry the user's session as wellOffer a short-lived, signed download link
A blob: address, or a button with no real linkA receipt or CSV generated by JavaScriptCustom code that passes the file's data from the page to the appGenerate the file on the server at an https:// address
A data: addressA canvas image or QR code saved as a fileCustom code that decodes the data and writes the fileServe the image or file from an https:// address

A blob: URL points at data held by the web page that created it. It is not a file on your server, and it can only be fetched from a matching web context. Android's download manager runs outside your page, and its request object is documented to take an HTTP or HTTPS address. An app that passes every download straight to it therefore cannot handle a blob: or data: link.

Developers work around this by running JavaScript in the page that reads the blob, converts it to text (Base64) and sends it to the app, which writes the file. It can work, but it is custom code, and it adds a bridge between web content and the app that has to be locked down. If a builder says it supports downloads, ask specifically whether that includes files generated in the page.

Why does the PDF download fail only for signed-in users?

If the app hands the address to a separate downloader, that is a new request, and your server may not recognize it as coming from the signed-in user. The usual result is a file that will not open because it is really your login page saved with a .pdf name. Android lets the app add headers to a download request, and common code samples use this to copy the WebView's cookie across by hand.

To check, download the file in the app, then open it. If it is only a few kilobytes or a viewer says it is damaged, open it as text and look for HTML. On your side, a download link that expires quickly and is tied to one file removes the dependence on cookies. Treat such a link like a password: keep its lifetime short.

How do I fix it without writing Android code?

  1. 1

    List your downloads

    Invoices, tickets, certificates, exports, menus and images. Note the link type for each, using the table above.

  2. 2

    Prefer real server files

    Where you can, replace in-browser generation with an https:// address that returns the finished file.

  3. 3

    Set the response headers

    Send the correct file type and a Content-Disposition header with a sensible file name. The app receives both from WebView.

  4. 4

    Add a fallback

    Email the file, or show it as a normal web page, so nobody is stuck if saving fails.

  5. 5

    Ask your builder

    Send them one example of each link type and ask which ones their app saves.

Builders differ here, so read their documentation. Median.co, for example, documents how its apps treat Content-Disposition (inline versus attachment) and offers a JavaScript command that downloads a file from a URL. That is a real strength if you can edit your site's code.

Also avoid forcing downloads open in a new tab or through a custom app link unless you have tested it. Links that leave the normal web address can produce a different error, explained in ERR_UNKNOWN_URL_SCHEME in a website app.

Where does the downloaded file go, and does it need storage permission?

It depends on where the app saves it. Android's documentation says that for apps targeting Android 10 or higher, saving to a public folder such as Downloads through the download manager does not need the WRITE_EXTERNAL_STORAGE permission. So a download feature alone is not a good reason for an app to ask for broad storage access.

If a download seems to vanish, two documented details matter. Only files saved to the public Downloads folder appear in the system's Downloads screen. And by default, the download manager shows a notification only while the download is running, so an app has to ask for one that stays after completion. A small file can finish before the user notices anything.

How do I test downloads before publishing?

  • Install the app on a physical phone, not only a desktop preview.
  • Test one example of every link type, signed out and signed in.
  • Open each saved file. A saved file is not proof that it is the right file.
  • Find the file again later from the phone's Files or Downloads app.
  • Try a file name with spaces and non-English characters.
  • Switch to mobile data and repeat the largest download.

Run these alongside the other mobile checks in how to optimize your website before turning it into an app.

Frequently asked questions

Why does the download button do nothing in my Android app?
WebView does not save files on its own. It notifies the app through a download listener, and if the app does not act on that notice, or cannot handle the link type, nothing visible happens.
Can Android's DownloadManager download a blob URL?
No. Its request object takes an HTTP or HTTPS address. A blob: URL refers to data inside the web page, so the app needs custom code to move that data out, or the site needs to serve the file from a normal web address.
Why is my downloaded PDF corrupted or unreadable?
One common cause is a protected file: the separate download request arrives without the user's session, so the server returns a login or error page that gets saved as a PDF. Open the file as text and look for HTML.
Does a website app need storage permission to download files?
For apps targeting Android 10 or higher, Android's documentation says saving to a public directory such as Downloads through the download manager does not require WRITE_EXTERNAL_STORAGE.
Can I fix WebView downloads by changing only my website?
Sometimes. Serving finished files from https:// addresses with correct headers removes the blob: and data: problem. The app still has to act on the download notice from WebView, so test the combination on a real phone.