Jan 17, 2026GoHost
So here’s a simple snippet for when you want to force a download of a file (such as a PDF, .doc etc), when a link is clicked.
The default action will open the document in the either the same browser window, or in a new tab/window by using the usual target methods:
View more
Your experience on this site will be improved by allowing cookies
Cookie Policy
These cookies are essential for the website to function properly.
These cookies help us understand how visitors interact with the website.
These cookies are used to deliver personalized advertisements.