Show page + download file simultanously

This might not be the most complex topic on earth but I never said that my aim is to support only the tech gurus out there with my open sourced ideas, so here we go.

Imagine you want to to show a “thank you page” and at the same time initiate a download. Let’s say a whitepaper your visitor is interested in.

There is an easy way of getting it done with a little bit of JavaScript, all ready to play around with for you on JSFiddle:

Have fun and please do consider that this approach will not work on mobile. You should rather point to a download destination the user has to actively visit. That is anyway best practice and you will see in my little example that there is a download link to click on, too.