[Web] Your download will start in a few seconds...

jochemstoel profile image Jochem Stoel ・1 min read

Download VS Code in 5 seconds

We have all seen this, it dates back to the 90's. You click a download link and you arrive at a page that tells you to wait a few seconds before the download starts.

It is very easy to replicate. Some function inside a setTimeout in JavaScript creates a HTMLAnchorElement, sets the href attribute to the direct URL of the file, a void download attribute to tell the browser it is a download and then triggers a click event.

I never questioned this but what exactly is the purpose of this? The only thing I can come up with is that it is some form of protection against crawlers (although I wouldn't know why that is necessary) or perhaps a way to force the user to visit the website and prevent linking directly from external webpages.

If this is actually the reason then it is not effective because the direct download URL is still in the page source so it can still be 'hotlinked'.


edit: apparently a lot of people say it is to show ads but many sites don't actually show ads but still use this functionality. StackOverflow

Download VLC in 5 seconds
Download TeamSpeak in 5 seconds

Posted on Aug 9 '18 by:

jochemstoel profile

Jochem Stoel


Pellentesque nec neque ex. Aliquam at quam vitae lacus convallis pulvinar. Mauris vitae ullamcorper lacus. Cras nisi dui, faucibus non dolor quis, volutpat euismod massa. Donec et pulvinar erat.


markdown guide

Here's my guess.

The page exists so that the the "download url" is always the same (example.com/download). This is a dynamic page, so the URL of the file that's actually being downloaded is able to change as needed (updated versions, different locales, etc.) without having to set up any kind of server-side redirects or expect users to be able to find the most recent version of that page.

The "please wait" message then exists because the download is triggered via javascript, and the script may take some time to download and get parsed, especially on slower devices/networks. And the "click here to download manually" exists for users who have disabled javascript to still be able to get that file.


This is probably the correct answer. To maintain the download permalink. Thanks Casey.


I'm going to go out on a limb here and say that the technical rationales seem to be mostly red herrings. This technique (meaning mandatory and opaque Javascript between the nominal download URI and and a URL/parameter set that actually fetches the file) seems to be almost exclusively used on sites that are doing sketchy things to squeeze money out of visitors, and are very seldom used by legitimate sites that have the same or greater technical need for version updating, mirror selection, etc.


A 303 response code feels simpler to me.


I guess it's about the UX. You let the user see what's going to be downloaded and provide some info about it (Version, OS, etc.)

Also if you have a bunch of mirrors for the file, you can choose which one is going to be used based on the download speed (for this one you'd need a long-running (1+ sec) test), geolocation, ip, etc.


Definitely is not a technical constraint (anymore), is about the UX and displaying other piece of information (like ads, help and documentation).

In the VSCode example you could dynamically replace the Download buttons with the correct link, the same way as the download starts after the intermediate page is visited. But by doing an intermediate page you solve more problems with 1 solution:

  • instant feedback - you press a button a new page opens (if the connection is slow a download is starting will not be instant)
  • page space - you now have a special dedicate page where you can put relevant information (like documentation, how to save the file, how to install) specific for that download file (platform, version)
  • automatic download (you can't do that on the main page, you do not know what version and platform the user wants to download
  • the users are now used to this behavior
  • all the other responses (unique url ..)

Back in the days solved a few tech issues (no one page apps), page views and ads were important.


I see it mainly used in conjunction with the automatic download that is achieved using response headers. Some browsers block this behaviour under different circumstances, so the link acts as a backup. This applies to the downloads that make you wait, although in that case the waiting is probably due to bandwidth throttling on their part, or as an attempt to get you to purchase their premium download subscription.

When it's used purely on its own, without the response headers, then it's probably the front-end developers who know how links work but don't know about response headers. This wouldn't be about any kind of UX, as the very act of visiting said page should be triggered by the user as a direct request on their part to perform the download. Moving the action to a link on a separate page is actually hurting UX, not improving it.


Depends which download site you are using? Places that host large 'not terribly legit' files will make you wait/limit bandwidth, then offer you a premium account for a small fee.. not gonna name any but I had to use quite a few when I was doing reverse engineering on a regular basis :)

Otherwise, I would agree that it's finding a good local mirror from a fixed download URL, most likely code provided by a CDN like this: akamai.com/uk/en/products/media-de...


One of the reason is to prevent other sites to steal your download link and paste it on their site to steal your traffic. The direct link generated in the download page is not always the same, it may have expiry time and/or being invalid when you send it to someone else or paste it in a different browser. It focrces you to share the perma link of the download page with proper information, ADs, invalidate outdated version and increase traffic of their site.


I've always been curious about this, excited to follow along and read more answers.


Thanks everyone for repeating everything I already said when I asked this question.


Guess: It's because of the ads. You just don't see them b/c of your adblocker


Even though the correct answer has been given already let's all applaud this incredible contribution and insight by Peter.


I agree with @defman 's answer, since with the advertising idea, I've also seen this occur on a lot of open source downloads as well that have no ads


I got 2 ideas:

1#: old system, lazy coders, dumping the usage of the link (but as you said, the hotlink is still there)

2#: try to ask them yourself, people love to answer if you ask correctly


Pretty sure most of them want the page to load so we can see more contant and more ads obviously.