Skip to content

Browser extension to redirect pages based on rules. Intended to stop the browser following links straight to the PDF of a paper, but instead to go first to the HTML index page for the paper.

License

Notifications You must be signed in to change notification settings

imurray/redirectify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Redirectify

⚠️ The Chrome version of this extension is currently in a separate branch for Chrome. This branch is for the Firefox version. In theory I intend to unify the two versions, 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.

I gave the extension a fairly generic name. The redirect rules are stored in a list at the top of the code, and can easily be added to. However, making this list updatable within the extension is unlikely to happen soon, partly because of time, partly because allowing any URL to be redirected opens up security issues.

Download

If you just want to use the extension as it is, get it from one of the official addon sites:

Until the branches are unified, the Chome and Firefox versions are likely to offer a slightly different set of redirects. 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.

Alternatives

  • 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.

Hacking

The code is written as a WebExtension for Firefox. It did work in Chrome, but Google are pulling support for the API it uses. There's currently a separate branch for Chrome. My intention is to move back towards a single code-base, but I want to wait for Mozilla to settle on what their manifest v3 support will be, and I may not find the time.

If you want to add to the redirect rules, you currently have to edit the source code. To run the extension from the source:

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.

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.

About

Browser extension to redirect pages based on rules. Intended to stop the browser following links straight to the PDF of a paper, but instead to go first to the HTML index page for the paper.

Resources

License

Stars

Watchers

Forks

Packages

No packages published