title: Unable to serve download links in google apps script
body: <p>UPDATE: I have found a solution. This doesn't necessarily address every case, so I will leave the question open for a short time in case someone can enlighten me more. I solved it by changing the format of the url: Google Drive allows this format for downloading files:</p>
  
  <p><a href="https://docs.google.com/uc?export=download&amp;id=FILE_ID" rel="nofollow">https://docs.google.com/uc?export=download&amp;id=FILE_ID</a></p>
  
  <p>So I don't know if this is a problem for other URL's; nor actually exactly why the .getDownloadUrl() doesn't work ... maybe someone can explain. But for now this seems to work in the browsers that I can test ...</p>
  
  <hr>
  
  <p>I have a simple WebApp script which I run on a Google Site by adding the Apps Script gadget. The gadget runs exactly as the Forms example on:</p>
  
  <p><a href="https://developers.google.com/apps-script/guides/html/communication#forms" rel="nofollow">https://developers.google.com/apps-script/guides/html/communication#forms</a></p>
  
  <p>The gadget is designed to do the following: when the page is loaded, a form is returned, and the user must enter a license key to get a link to download a product. My code serves the form OK, and gets the form submit OK; and it then validates the key, and if valid, sends back a link to download. All that works fine; and the problem is that no matter what I try to return for the download link, the caja iframe wrapper is preventing the click on the link from actually downloading the file.</p>
  
  <p>My preferred URL to return is in fact via the Drive API: the download file is on the Google Drive, and I get the download link like so:</p>
  
  <p>DriveApp.getFileById(downloadFileId).getDownloadUrl()</p>
  
  <p>But when the returned link is clicked inside that caja iframe generated for the WebApp gadget, nothing happens. I have tried a few other URL formats pointing to that file on the Drive, but nothing is working for a download.</p>
  
  <p>Is this possible?</p>