The above can be copy-pasted into a terminal or save it as a bookmarklet by saving the following as the URL (sorry, GitHub's markdown won't let me directly link a bookmarklet)
javascript:(function openLinksInNewTab(){new Set(Array.prototype.reduce(document.querySelectorAll('a[href],area[href]'),function(a,e){ e.href[0]!=='#'&&a.push(e);return a},[])).forEach(function(a){window.open(a,'_blank')})}());
I could only get this working after I added the
new
keyword beforeSet
.Also as a heads-up to anyone else you'll see a warning somewhere that the page you're on wants to open pop-ups, that (in Chrome at least) you can just click allow.
bookmarklet
bookmarklet but ran through prettier