But that's not the same as clicking on a link and downloading the file

Well, actually it is. When you click on the link, your browser sends a HTTP GET request over to the web server and negotiates a connection. When it has negotiated a connection, it starts to download the file to a temporary location. It then tells your operating system that it's downloading a file and asks what to do with it. This is the point where you will see an OS-level dialog box as the operating system defers that request and asks you what to do.

Once you have told the operating system which filename and which download location to use, and decided if you want to overwrite any existing files, the operating system will pass this information back to the browser. The browser then copies the file it has downloaded to a temporary location, the location specified by the operating system.

What you are actually doing by implementing this solution is taking the browser and the operating system out of the equation. A lot of people don't feel comfortable with this solution when they first see it. If you are one of those people, have another read of the last two paragraphs.

Notice that the only interaction with the website is the action of clicking on the download link (usually an anchor element with an href attribute, or maybe a form post if it's a little bit more complex). The code that your developers have written does not have any download functionality; they are just providing a link that the browser recognizes and processes accordingly.

By bypassing the browser and the operating system code, you are only bypassing code that your development team has no control over. Let's face it, if you click on a valid anchor to download a file and the browser has a bug that prevents it from working, there is not much you can do about it anyway. You could raise a bug with the browser vendor, but you can't force them to fix it. Even if you could force them to fix it, it's unlikely you will be able to force all of your users to download this updated version of the browser.

Secondly, what are the chances of a browser vendor releasing a browser version that cannot download a file when you click on a link? I would suspect they are pretty slim; browser manufacturers have a pretty good idea of what they are doing and I would be shocked if they didn't have at least one test that checked that file download functionality worked correctly.

So we have successfully downloaded the file, and our test has passed. Are we done? Not quite—we still haven't checked to see if the file that we downloaded is the correct one.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.26.176