Skip to content

Instantly share code, notes, and snippets.

@Firsh
Created May 8, 2022 16:14
Show Gist options
  • Save Firsh/cd60a53aed6bd0d819e19d8835aff721 to your computer and use it in GitHub Desktop.
Save Firsh/cd60a53aed6bd0d819e19d8835aff721 to your computer and use it in GitHub Desktop.
Userscript to force download from links to PDF files
// ==UserScript==
// @name PDF download
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://thefalconmethod.com/*
// @match https://www.oaktreecapital.com/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.querySelectorAll('a[href*=".pdf"]').forEach(el => {el.setAttribute('download','')});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment