I know how to redirect the form to another page after submitting a Contact form 7 build form in wordpress. So I can redirect it to a pdf file for example. ( it then opens in the browser)
But what I would like to have is a direct download upon submission. no redirect.
The code I use to redirect the form to the pdf file is:
on_sent_ok: "location = 'url to pdf file here';"
The perfect way it would be that the form will disappear and say
a Thank you notice on the place of the form and start the download of the PDF file
You can force a pdf to be downloaded directly instead of being viewed on the server by adding this .htaccess file on the PDF directory.
.htaccess – this will force PDF to be downloaded
or you you can try javascript ( untested )
Since the on_sent_ok has been deprecated, here is an example you could use for inspiration.
I had the need to add a download CTA after the content of all case studies of a website, but “in exchange” of user’s data for:
So the code looks like this: