Javascript After URL

Is it possible to have a link that when clicked, executes the javascript on a different page?

For example, to download a particular file, the person must click this link, and then click on “download,” which executes a javascript action. A popup then confirms that the download was successful. Would it be possible for all of this to happen from clicking on one link instead of the two that you have to?

It is possible, just add a normal anchor with the link and then in the referenced page call the function without any user interaction

I neither own nor influence the site I am linking to.
Any way to do this without that?