⚠️ You are looking at a chrome-specific branch. This branch supports the Manifest V3, version of Chrome's extensions system now that Google is removing support for V2. It requires the new declarativeNetRequest API. In theory I intend to update the Firefox extension to use the samesrc/rules.json
and make this the main branch. But no promises if/when I'll find the time.
Links to academic papers in emails and on websites often point to the PDF of the paper. However, on sites like arXiv, I'd much rather be pointed to the HTML page. The index page is quick to load, and has meta-data not available in the PDF, such as the version history. I've given up trying to ask people not to deep-link to PDFs, and have instead written a browser extension to do what I want.
Install links: Firefox and Chrome
After installing this extension, links to PDFs on quite a few academic pages (listed below) redirect to an HTML index page, unless you clicked on the link from the main site.
- ACL Anthology: this pdf link redirects to this webpage
- ACL Anthology (old site): this pdf link redirects to this webpage
- ACM: this pdf link redirects to this webpage
- APJ: this pdf link redirects to this webpage
- arXiv: this pdf link redirects to this webpage
- bioRxiv: this pdf link redirects to this webpage
- Citeseerx: At the time of writing I couldn't get any html paper summary pages to load on citeseerx, so I have removed support (but left the site permission in so I can fix it later without the extension autodisabling). Also many old links to PDFs on citeseer have broken. See this math.meta.stackexchange post for possible help fixing broken links. You can also try the internet archive.
- Indico: this pdf link redirects to this webpage
- JMLR: this pdf link redirects to this webpage
- JSTOR: this pdf link redirects to this webpage
- NeurIPS: this old-style pdf link redirects to this webpage. And this new-style pdf link redirects to this webpage.
- OpenReview: this pdf link redirects to this webpage
- PMLR: this pdf link redirects to this webpage
- Project Euclid: this pdf link redirects to this webpage. (Supporting URLs containing
Download?urlid=
turned out to be complicated. I may have to remove those rules if they cause too many issues.) - ResearchGate: this pdf link redirects to this webpage
- Semantic Scholar: this pdf link redirects to this webpage
I gave the extension a fairly generic name, because I'd like to make it easy for
users to choose and add any redirect rules of their own. However, I haven't
managed to find time for that yet. The redirect rules are stored in
src/rules.json
, and developers can easily add to them (see below).
If you just want to use the last release of the extension, get it from one of the official addon sites:
Until the branches are unified, the Chome and Firefox versions are likely to be out of sync, so not all the examples above will work as advertised in Firefox. The Firefox version should work in Firefox for Android. It used to be a bit of a pain to install Firefox extensions on Android, but may be easier now.
-
arxiv-url-replacer a different Chrome extension for arXiv, with a GUI. Edits links in pages, instead of intercepting requests. A similar approach could be taken using TamperMonkey, which would immediately work in multiple browsers. It can be tricky to catch all links though.
-
Allen.YL Lee points out that a bookmarklet could be used to escape from a PDF after the fact, and provides an example.
And see the forks of this Github repo.
Currently this branch only supports Chrome (I mainly use Firefox, but hacked together this branch for Chrome when Google broke compatibility). Eventually I may unify the code with the Firefox branch.
To work on the extension:
-
Edit the rules in
src/rules.json
-
The
src/compile_rules.py
script updatessrc/manifest.json
in place, and buildssrc/dnr_rules.json
-
To try out your changes, go to
chrome://extensions
, check developer mode, click load unpacked extension and select thesrc
directory. See Chrome's extension development getting started guide for more details.
If proposing code, please check both of the following:
-
Requests for PDFs from external sites or the location bar are redirected.
-
Each redirect ends up at an HTML page with a link to the PDF, and clicking that link does give the PDF.
If you add support for a new site, please add an example PDF URL to test_cases
.
Thanks!
Experience suggests I might take ages to look at proposed changes; sorry. I don't want to pester 100s of people with permissions warnings, so I will delay adding support for new sites until I'm forced to make a major update (if ever). Eventually I hope to make the rules configurable, opt-in, and use optional permissions. But it's been years, and I haven't found the time to do it yet.