title: APK download doesn't work on stock Android browser
body: <p>I have a page with a button that redirects to a PHP script that starts an APK download, like so ($androidPackage is the file name and $package contains the absolute path):</p>
  
  <pre><code>   header('Content-Description: File Transfer');
     header('Content-Type: application/vnd.android.package-archive');
     header('Content-Disposition: attachment; filename=' . $androidPackage);
     header('Content-Transfer-Encoding: binary');
     header('Expires: 0');
     header('Cache-Control: must-revalidate');
     header('Pragma: public');
     header('Content-Length: ' . filesize($package));
     ob_clean();
     flush();
     readfile($package);
     exit; 
  </code></pre>
  
  <p>This approach works on Chrome for several Android devices, all of the major desktop browsers, and on the stock browser on some Android devices.  However, on my phone (HTC Rezound) and the Galaxy Tab 2, on the stock browser, the download does not work on a short press of the button - it doesn't start, even though this works on Chrome on those devices.  A long press on the button, followed by selection of 'Open' from the context menu that appears, does work to download the APK from the stock browser.  Any ideas as to why the download doesn't start with a short press on the stock browser?</p>
  
  <p>edit:</p>
  
  <p>I should mention that the button used to link to this download is located in an iframe.  If instead I do a document.location.href = (download script URL) instead of loading the script's source into the iframe when the document loads, the download does work with a short press.  Something to do with how the stock browser handles iframes?  The page and the script it points to are on the same domain.</p>