We have this exact same problem with our centralized content server. As an alternative to using anchors, we've looked at embedding the content, instead, but have found issues with some content types not rendering in browsers. This would also not help for files that we want the student to download.
An alternative that's being considered is to use a timed Event Listener to undo the addition of the relationship attribute in anchors with a reference to an external URL. We haven't reached a decision on it, because there's already several things we're doing this way and it can slow-down loading speeds.
If you'd like to give it a shot, here's the snippet:
// Filters anchors for external hyperlink references
function filterExternal(link) {
var domain = new RegExp('/' + window.location.host + '/');
return (!domain.test(link.href));
}
// Onload, search for anchors with relationship attribute and an external
// hyperlink reference and remove the attribute
window.onload = function() {
var timer = setInterval(function() {
var links = document.getElementsByTagName('a'),
j = 30, // j = How long should it run for? (in seconds)
k = 0.5; // k = How often should it execute? (in seconds)
for(var i = 0; i < links.length; i++) {
if(links[i].hasAttribute('rel') && filterExternal(links[i])) {
links[i].removeAttribute('rel');
}
}
j = j - k;
if(j <= 0) {
clearInterval(timer);
}
}, (k * 1000)); // .5 second timeout
}
It hasn't been tested outside of a browser's Console, but testing via the Console and it performed as expected:
- Start an interval of 0.5 seconds that will:
- Identify all anchors on the page; Set the length of time you want it to run the script; Set how often you want it to run
- Cycle through all the anchors and to remove the relationship attribute if both conditions are met:
- Anchor has the relationship attribute
- Anchor has an external hyperlink reference
- Update the timer to reflect the difference from the interval
- Clear the interval if the timer has run out
This is not a substitution for a fix from Instructure, merely a workaround that, hopefully, will work for you.