29

But let's say I have a URL, and it's either a SWF, a PNG or an MP3 or something. How can I force my browser (in this case I'm using Google Chrome) to download the file, instead of automatically displaying/playing it?

My quirky way around this is to create a one line HTML file with a hyperlink inside it pointing to the URL, then right click and save link as. But there has to be a better way to do this. I just can't find it by Googling.

7
  • Can you provide the URL? Mar 14, 2014 at 10:22
  • 1
    You can't force your browser to download this. The web link points to a file which contains a built in rendering system which displays the content within the page. If you own the website you can change code to do this, but from your end it would have to be a save as job. Mar 14, 2014 at 10:56
  • 2
    It's absolute rubbish that Chrome doesnt have this feature built in. I should just be able say right click in the url bar and click save as, but instead I have to go a stupid long winded way. I'm still dertermined there's a solution out there.
    – Chud37
    Mar 14, 2014 at 11:42
  • 1
    There might be. Possibly a plugin, but none that I am aware of. Mar 14, 2014 at 11:43
  • 2
    If you haven't tried it yet (which you probably have, but I'm including here just in case), Cmd + S works wonders sometimes. I've found that I can save PDFs, MP3s, SWFs, PNGs with it. Not quite automatic, but it works 99% of the time. Sometimes, webpages block Cmd + S, in which case you'll have to go to File > Save Page As...
    – Caleb Xu
    Nov 12, 2015 at 6:56

6 Answers 6

27

Download File from URL

There are a couple ways to do this. As mentioned, using the developer tools could work (more likely it will give you the url to the file) and right-clicking the link will work. Alternatively there are these options.

In Chrome

  1. Go to the URL
  2. Right-click the webpage
  3. Select Save As...

For verification purposes, here are png, jpg, and mp3 links. Follow them and try these steps. However, in my experience. If you already have a url to a file, opening up Chrome and following these steps is rather tedious so here is an alternative.

In Command Line

  1. Open your favorite terminal emulator
  2. type curl -O URL
  • Where O is written in capital
  • And URL is the URL to the file, e.g. http://example.com/file.mp3
3
  • 1
    Curl is also available for Windows (check their download page). I have it installed so I tested your command. It works like a charm! Thanks! Sep 4, 2016 at 14:53
  • Works on .mp4 as well, I believe this works on almost any file type? Apr 4, 2019 at 11:15
  • 1
    If you run into an error such as The term 'blarg=blarg is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. it may be because you have an & in your URL. Encapsulate the URL in double-quotes to fix that.
    – Colin
    Aug 26, 2020 at 23:58
9

For Powershell, this example works great:

invoke-webrequest -uri http://files.animatedsuperheroes.com/themes/spiderman94.mp3 -outfile "c:\Spiderman94.mp3"

This was confirmed with Win10 x64 1607.

4

You can see the files a page loads using Developer Tools. Under the "Sources" tab in Developer Tools you can right-click a file and save it. For example, the webpage http://www.oizo3000.com/flash/projetmpc.swf loads the file "projetmpc.swf".

0
3

Obviously not useful for everyone, but if you have a Mac, put the URL into Safari and press Option-Return.

1
  • Tagging on a 5 year old thread to say that I just tried the Windows equivalent of this on Firefox (106.0.2 64-bit). I entered the URL into the address bar and press CTRL+Enter I was prompted with a "Save As" dialog box.
    – JoeSinc
    Nov 1, 2022 at 15:28
1

This isn't quite what you were looking for but it might might make your life a little easier.

Create a new bookmark in your browser, set the name to "Get Download Link" or what ever else you would like and set the target/location to

javascript:document.body.innerHTML="<a download" + "Click here to Download".link(window.location.href).substring(2);

Whenever you are viewing something you want to download just click that bookmark and it will replace the content with a link to the content. You should be able to click to download, otherwise you can always right click and save like normal.

-1

If the URL is on a webpage,

  1. Install a clickable URL converter chrome-app.

Clickable-Links

  1. Context-click (right-click) on the link and select "Save Link As..." from the menu.

context-menu

  1. Use the popup dialog to save the file.

popup dialog

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .