On a site I'm developing I'm providing download links to files on remote servers, and I'd like to have a "download count". So, whenever someone clicks a link, it adds "1" to the counter. The only way to do this is to link to another unique page on my server, add "1" there, then automatically redirect to the file being downloaded.

The main problem with this is if someone right clicks on the link to download the file, he will be saving the page that does the adding and redirection, and not the actual file he wants to download. I've seen on a website that when someone right clicks the "counting" URL, it still downloads the correct file, as well as adds "1" to the download count. How do I do this? I figure it's javascript, so I posted this here