I have a web app that lets users download a pdf file. It is ASP.NET MVC and it all works fine on desktop browsers, iPhone, Android Chrome, and in a native Android app that o
Found my own answer and it was so much simpler than where I was looking. My page with the download link is in an iframe. Something in the Android default browser loses your download if it occurs in an iframe. I added target="_blank" to the a tag that initiates the download and everything now works fine.
Here is some sample code to demonstrate the the problem and the fix.
<html>
<head><title>Test page</title></head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<body>
<a href="http://www.adobe.com/products/eulas/pdfs/Photoshop_On_a_Server_Policy_5-31-2011.pdf">
Download sample pdf</a><br />
<iframe src="inner.html" />
</body>
</html>
and inner.html:
<html>
<head><title>test iframe</title></head>
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<body>
<p>This does NOT work on Android default browser.
<a href="http://www.adobe.com/products/eulas/pdfs/Photoshop_On_a_Server_Policy_5-31-2011.pdf">
Download sample pdf within iframe</a></p>
<p><a href="http://www.adobe.com/products/eulas/pdfs/Photoshop_On_a_Server_Policy_5-31-2011.pdf"
target="_blank">Download sample pdf within iframe with target</a>.</p>
</body>
</html>