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.
66 Answers
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
- Go to the URL
- Right-click the webpage
- 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
- Open your favorite terminal emulator
- type
curl -o myfile.mp3 '
- Where
myfile.mp3is what you want to call the file you're downloading - And is the URL to the file
[Note: This works for Linux and Mac users. If you are unfortunate enough to be a Windows user trying to use the cmd line, use Cmder and this method will work or if you're a purist try this]
3For Powershell, this example works great:
invoke-webrequest -uri -outfile "c:\Spiderman94.mp3"This was confirmed with Win10 x64 1607.
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 loads the file "projetmpc.swf".
0Obviously not useful for everyone, but if you have a Mac, put the URL into Safari and press Option-Return.
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.
If the URL is on a webpage,
- Install a clickable URL converter chrome-app.
- Context-click (right-click) on the link and select "Save Link As..." from the menu.
context-menu
- Use the popup dialog to save the file.
popup dialog