MODX Community

Automatic Download (Software or PDF) based on Form Selection

So, what I have working now, is a form, with 3 options for what software someone wants to download. The value for each select options is the ID of a resource where they can download it.

Using the setRedirectTo hook here, I have that working. However, ideally I’d like to make the download more automatic. I almost need a second redirect I feel like. Anyone had experience doing this?

Maybe you can redirect to a static resource with a “Content Disposition” of “Attachment”.

Yes, that is what it is now.

Not sure I understand your question, but for a “second redirect” you probably have to use Javascript.

<a id="download_link" href="[[++base_url]]assets/downloads/mydownload.pdf" download>Download</a>
<script>
$(document).ready(function(){
   $('#download_link')[0].click();
});
</script>