Skip to content

Instantly share code, notes, and snippets.

@disco0
Forked from derjanb/GM_download_emu.user.js
Last active October 21, 2020 12:27
Show Gist options
  • Save disco0/3db512ba2bac01dcca9efd73d5ef5762 to your computer and use it in GitHub Desktop.
Save disco0/3db512ba2bac01dcca9efd73d5ef5762 to your computer and use it in GitHub Desktop.
GM_download Alternate
// ==UserScript==
// @name GM_download emulation
// @namespace http://tampermonkey.net/
// @version 0.1
// @description emulate GM_download functionality
// @require https://github.com/eligrey/FileSaver.js/blob/master/dist/FileSaver.min.js
// @grant GM_xmlhttpRequest
// @copyright 2014, Jan Biniok
// ==/UserScript==
window.GM_download_alt = function(url, name) {
GM_xmlhttpRequest({
method: 'GET',
url: url,
onload: function(r) {
var bb = new Blob([r.responseText], {type: 'text/plain'});
saveAs(bb, name);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment