Instructables

How to save direct file links or Circumvent right-click download restrictions

Occasionally one finds or is sent a URL of a file, such as a mp3 or a mpeg. If one pastes that link into a browser, the browser's default action will occur, which often will be to play the file. But what if one only wants to save the output?

Alternatively, some sites annoyingly disable downloading through the prevention of right click action, specifically the ability to use the "save link as" or "save target as." I don't like when they do this, and I want a way around it.

In either case, there's an easy solution found through some simple HTML coding, which I was inspired to post because of Spacekidkyle's HTML Instructable.

 
Remove these adsRemove these ads by Signing Up

Step 1: A simple HTML page

Open a new file in a basic text editor such as Notepad or Textpad, (As an aside, Textpad is a great tool.) and type in the basic components of an HTML page.

Any HTML page just needs a few core tags. Spacekidkyle's post covers this, but they are: HTML, HEAD (and technically you don't really even need this), and BODY.

Step 2: Add in a link

Spacekidkyle didn't mention this, so I'll go into it in a little more detail. A hypertext link is embedded in an anchor tag, coded with the letter A. The link is preceded with the text "HREF", which stands for Hypertext Reference.

An anchor tag looks like this:

<A HREF="link goes here">Text describing the link goes here</A>

In the image below, I've added two links, separated by a line break (the <br> tag).

Step 4: Open in a browser, and download whatever you want

Double click on the file you just saved. Doing so will open that file in a web browser, and you can freely right click on any link you just created!
DawoodNajam5 months ago

Please help me. the html is alright but when I click on the downloaded link which I created it does not do anything.

Please help me.

emalthya4 years ago
This. Is. God. That is all.
whiteagle7 years ago
You could just install Opera 8, which is now free. It pretty much always lets you right-click and save-as, not to mention a whole lot of other features (i.e. copy image location, which is handy for sending images with im or email) and it has a "quick download" box for you to drop url's into specifically like this.
lemonie7 years ago
The right-click prevention is embedded in the page source. If you 'save as' you can edit that part out. As far as I understand your instructable, you're doing something similar, but lifting the hyperlink out and pasting it into a new file? Could you edit the instructable to explain how the right-click function is disabled, and how you are circumventing it? I know these things, but it would add a little more to the instructable. L
jeffreyf (author)  lemonie7 years ago
I'll update it in a bit, but yes, essentially I'm lifting the hyperlink out. There are a number of situations where it's a lot quicker to do this then it would be to save a page, edit the javascript, and reopen it. In general, however, I've found this sort of technique useful for things which one would otherwise have to open in a browser and wait for to load. It allows one to just right click and save as, which is far less resource intensive.
I'm warming to your approach. I don't keep a blank .html page for this purpose, but now I don't see why I shouldn't.
DoItOrDie7 years ago
There is a site called KeepVid (http://keepvid.com/) which can do much the same thing for you. It's primary purpose is to enable one to download videos from sites like Youtube but it has an unintended bonus. Whatever link you enter will be echoed back in the download area with the <A HREF anchor tags added, thus allowing you to right click on it and do a "save as." It will do this even if the link address you enter is not a valid one for one of the video sites. Just look for the label Original Link.
jeffreyf (author)  DoItOrDie7 years ago
Good find! Thank you.
I'm glad I helped you to post this. This is useful, a friend sent me a link, I'm building his site for him, and when I downloaded it, it started playing it, it didn't save! This could be very useful. Good to know!
Jezza Bear7 years ago
I feel this is a little over complicated. A few sites place javascript in their pages disabling the right hand mouse click. This function is a waste of time really as they cannot diable the View Source or View Selection when text is selected. Some sites are now disabling the left hand mouse as well. When it comes to intellectual property this method is used to prove that the plagiarist went that little bit further to copy the code and efforts were made to reduce risk of copying, it is not there to prevent. In most browsers it is very simple to copy the URL from the code, it is a quick copy and then a paste into the search bar. This is the same for all forms of media from MP3, GIF and jpeg; if the reference is there in the code, it can be copied (legally or illegally) Just a small note, your

tag needs a closing tag in your example

hehe - I have the firebug extension for firefox... not only can I grab source code easily - I'll also know when they screwed up their code :P Firebug also has this neat little feature that allows you to "inspect" regions of a page -- wherever your mouse is, it will display that relevant bit of code. This has saved me hours of debugging time :)
Cool...I have always kept my Firefox installation as a vanilla one ,shying away from too many extensions. I have FF 1.0.7 on my laptop and FF2 on my home PC so that I can test my web pages. Is firebug available for both versions:-)
Looks like it works for 1.5 and up (including 2.0+). I only have this and a drag/drop extension installed - nice and clean :P

https://addons.mozilla.org/firefox/1843/
Thanks...doh I meant 1.5.0.7 :-)
Couldn't you just open the link in the browser, then as it's playing in your browser just go to File and then Save Page As...?
jeffreyf (author)  chrisswiss837 years ago
You could, generally, but that requires you have the whole thing load in your browser before doing so. If it's a large file, or a pdf, multiple files you want to save simultaneously, or some other combination, "saving as" works much better as a non-disturbing background action.
spinach_dip7 years ago
while there's nothing wrong with this, it might be easier to use a command line tool such as wget or curl

curl, available on every platform, is already installed on OS X.

$ curl http://example.com/really/cool/mp3.mp3 -o cool-mp3.mp3$ man curl