Tags for this article: download tag, html, links, php, tutorial, web design, website
Whenever you create a link in a particular Webpage, it’s obvious that most of the Web browsers will automatically attempt to open that particular link in the browser window. At present, with the use of various plug-ins and many other features, browsers will be able to open more files the files that they were forced to download. In times, this is the one we want mostly as after all we are building WebPages. You’ll also post your files sometimes to your Website where you want the browsers to download in to their hard-drive rather than just viewing in the Website’s browser window.
If you want the browsers to download the content from your Website, an HTML download tag would be the perfect solution. But unfortunately there is no such tag as an HTML download tag. If you want to set up some file download files in your Website, you just link the file in same way as you would link a particular file in order to open in that browser window. Without a HTML download tag, you can initiate your download, as there are some ways to do it.
Do tell your Website readers regarding their Browser functionality
The browsers that are coming today are very modern in nature that has context menu. If you right click the mouse button this context menu will appear (or options plus mouse button for a one button Macs). Whenever you right click on a particular link, one of the options that appear on the context menu is “save link as…” or “save as…” if you choose this, that file which is on the other side of that link will be downloaded to a hard drive even though it could be opened in that browser.
To emulate HTML download tag, the simplest way or method is by telling the people to just right click on any of the particular link that is to be downloaded and you can write some thing like this as mentioned below
(Option-click or right-clicks on that particular link and then choose to do “save as…” in order to download that link to the hard disk directly)
In Order to download, compress the file
If you want to automatically download the file, then compress your file using your using your operating system and the compression is done by just zipping the file. The files that are zipped will automatically download.
With PHP trick the browser
At last, if you have the knowledge of some PHP, you can just use 5 simple line of PHP script, so that you cab force the Web Browser in order to download the particular file even without zipping the file or else you can ask the readers to do whatever they want. This type of method relies only on HTTP headers in order to tell the browser that this file is just an ordinary attachment rather than it is a Web document. (This PHP will just allow you to change HTTP headers).