TUNDRAsearch download fix

Download links on the University of Northampton's tundrasearch server (e.g. those linked to from university web pages) don't work in Chrome and Firefox. This tool will rewrite the links to point directly to TUNDRA, so you can access them without a file error in these browsers.

Before you begin

The only officially supported browser for TUNDRA downloads is Internet Explorer (IE). If you need a file urgently, you should use IE. If you can't access the file using IE, you won't be able to access it using TUNDRAfix - you'll need to contact IT Services if this is the case.

Note: Microsoft's Edge browser won't work, but the icon is very similar to Internet Explorer. Make sure you're using IE and not Edge. If in doubt, check https://www.whatsmybrowser.org/. In Windows 10, Internet Explorer can be found under the Windows Accessories folder in the Start menu.

Installation

TUNDRAfix can be used in Chrome and Firefox. It was last tested in Chrome v78 and Firefox v69.

To install, drag the TUNDRAfix button to your bookmarks toolbar ▶ TUNDRAfix

Using TUNDRAfix

TUNDRAfix is only needed and only works on tundrasearch pages. You're viewing a tundrasearch page if the URL begins tundrasearch.northampton.ac.uk. If you try to use TUNDRAfix somewhere else, it'll let you know (you can't cause any damage).

After loading a tundrasearch page, click the TUNDRAfix button in your bookmarks toolbar. You'll see a message telling you how many links have been fixed. Download links on the page should then work as expected.

Important! Nothing will happen unless you click the TUNDRAsearch button. If you load a new page, or reload the page you're on, you'll need to click the button again.

I don't have a bookmarks toolbar!

Sometimes the Chrome bookmarks bar will be hidden. To show it, press ctrl-shift-b or go to the Bookmarks menu and select Show bookmarks bar.

In Firefox, you can either right-click the bookmarks icon and select Bookmarks Toolbar, or make sure Bookmarks Toolbar is activated in the View > Toolbars menu. If you're on Windows and can't see the View menu, press Alt to bring it up.

What does it do? Is it safe?

When clicked, the bookmarklet will:

The bookmarklet doesn't:

To undo any changes the bookmarklet has made, just reload the page and the links will stop working.

Can I see the code?

You can! The code is all contained in the bookmarklet, but here's a readable version:


        if (window.location.hostname == 'tundrasearch.northampton.ac.uk') {
            var els, h, e, f, id, t;
            // Find all 'showimage' links:
            els = document.querySelectorAll('a[href^="showimage.aspx"]');
            if (els.length) {
                els.forEach(function(e) {
                    // Get the download link:
                    h = e.getAttribute('href');
                    // Simplify the filename:
                    f = e.textContent.replace(/[^a-z0-9\.]/gi, '_');
                    // Find the item ID:
                    var id = /\d*$/.exec(e)[0];
                    // Replace the download link with direct version:
                    t = h.replace('showimage.aspx?index=', 'https://tundra2.northampton.ac.uk/otcs/livelink.exe/' + id + '/' + encodeURI(f) + '?func=doc.Fetch&nodeid=');
                    e.setAttribute('href', t);
                })
                // Report back - divide by 3 because each row contains three links:
                alert('Found and fixed download links for ' + els.length / 3 + ' documents.');
            } else {
                alert('No download links found.')
            }
        } else if (window.location.hostname == 'tundra2.northampton.ac.uk') {
            alert("You're on the main TUNDRA server - you don't need to use this tool.")
        } else {
            alert('This tool only works on the website tundrasearch.northampton.ac.uk.')
        }
    

I still can't access my file

If a file link still doesn't work after using the TUNDRAfix button, please try downloading the file using Internet Explorer. If you can't download the file in Internet Explorer, contact IT Services or the file owner for help - the TUNDRAfix button can't solve these kind of issues.

Disclaimer

TUNDRAfix is an entirely unofficial solution that I created for my own convenience. You're welcome to use it, but I can't guarantee it will work for you. I have no direct involvement with TUNDRA, so I'm afraid I can't help with any general TUNDRA enquiries - contacting me will only slow things down, so please go directly to IT Services.

Feedback

If you have any feedback on TUNDRAfix, please let me know: [email protected].

Thanks for trying TUNDRAfix!