Farid Zakaria

Archive 2 min read

Chrome Download Extension API


This post comes from my original WordPress blog, written between 2009 and 2018. It is kept here verbatim as an archive — the formatting did not always survive the move, and I no longer agree with all of it.

Can't Wait

Ever since work began on my HypeMachine Chrome Extension one of the biggest requests from people was to make the arrow button launch a 'Save As' download box rather than playing the mp3 in the browser. How the browser handles files is determined by it's Internet Media Type (MIME) which is set by the server.

Mp3's for instance have the MIME 'audio/mpeg' in the header

Whenever Chromium notices a file with the audio/mpeg MIME it automatically loads the file in the webplayer present in the browser, leading to people having to right click the button and select 'Save As' manually. I was hoping that there was functionality in the Chrome Extension API to cause downloads given URL however it turned out it was not the case. Until now. Sorta.

chrome.experimental.downloads

Looks like work has begun on a new API (experimental) to offer the functionality I was hoping for! The issues and code can be tracked as follows:

Although the changelist is supposedly several weeks away from being committed and usable, discussions regarding the API and feedback are ongoing. Once the changelist is submitted, I can begin to tinker with adding it to my extension, however I will have to wait for it to be no longer under experimental before updating it in the Chrome Store.

I'm curious to see what other extensions will benefit from this API.

2 archived comments

Ruben 2011-11-28

Thanks for this blog point, which pointed me to the (well hidden!) API. I have tried experimenting with it, but support seems fairly incomplete for now. For an example, see https://github.com/RubenVerborgh/ShowInBrowser

Farid Zakaria 2011-11-28

@Ruben: very cool. I haven’t been keeping watch on the API but nice example.

Looks like enough has been completed for me to use on my extension however I need to wait for it to move out of experimental.