Despite what you may have heard to the contrary, the main reason I'm an academic is for the free stuff. I'm not talking about your typical "real world" free stuff: t-shirts with start-ups' logos, various office supplies, office space, scholarship-funded trips to SoCal, and even coffee (though I do love my free coffee...). No, I'm talking about digital free stuff: classical music and digital library archive access.

I use the Naxos Music Library and the ACM digital library all day, every day. This is made possible by an institutional subscription through UW, which I am very grateful for. When I'm on campus, life is good: I listen to all the classical music I can handle and read oodles of papers.

Off-campus use of these subscriptions requires going through the proxy server, which involves munging the URL and then logging in. This is not a big deal for playing music, because I can just bookmark the munged URL and log in once. But every time I find myself on the ACM DL page for a paper I have to edit the URL by hand (the horror!). Hence this post.


I'll give two ways of automating this task to varying degrees. The first is a bookmarklet that you store in your bookmarks folder/bar. When you click it, it edits the current tab's URL for you. The second is slightly more heavy-handed: it's a userscript that you can run with Greasemonkey/Tampermonkey that will automatically detect when you access the ACM DL from off campus and edit the URL accordingly.

Step 0: Partial automation by bookmarklets

Create a new bookmark. (In Chrome/Firefox, you can press Ctrl+Shift+o to "manage bookmarks" and then create a new bookmark from there.) For the URL, copy-paste this:

javascript:(function(){window.location.hostname+=".offcampus.lib.washington.edu";})()

Go to some URL. Click the bookmark. Now you're using the proxy! The code is nothing too serious: just append the proxy address to the hostname.

Step 1: Monkeys for full automation

Install Greasemonkey or Tampermonkey. Then add the following script.

// ==UserScript==
// @name       UW auto-proxy
// @version    0.1
// @description  automatically invoke the off-campus proxy on ACM DL
// @match      http://*.dl.acm.org/*
// @copyright  2013, james r wilcox
// ==/UserScript==

if (document.evaluate('.//a[@title="Buy this Article"]',
                      document.body,null,9,null).singleNodeValue) {
    window.location.hostname += ".offcampus.lib.washington.edu";
}

The script will only run on URLs ending in .dl.acm.org. It checks to see if the "Buy this Article" link is present (which only happens when you're off campus) and redirects you as before.

Enjoy!