Can several links be opened at once in Safari?
Imagine you are on a page with a lot of links:
Would it be possible to select all the links and open them all in one single Command-click? As such:
I am often finding myself Command-clicking links for dozens of minutes a day, and wishing I could open more links all at once. Surely I'm not the only person in this situation!
Best Answer
There is a way to do something close - it involves adding a bookmarklet to Safari and selecting that once you're on the page.
However, this will either open only the hyperlinks you've selected (i.e. highlighted) on the page or it will open all hyperlinks found on the page if you haven't highlighted any. In other words, it doesn't work in the Command + click manner you want.
If you're interested, here's the process to set this up:
javascript:(function(){var n_to_open,dl,dll,i; function linkIsSafe(u) { if (u.substr(0,7)=='mailto:') return false; if (u.substr(0,11)=='javascript:') return false; return true; } n_to_open = 0; dl = document.links; dll = dl.length; if (window.getSelection && window.getSelection().containsNode) { /* mozilla */ for(i=0; i<dll; ++i) { if (window.getSelection().containsNode(dl[i], true) && linkIsSafe(dl[i].href)) ++n_to_open; } if (n_to_open && confirm('Open ' + n_to_open + ' selected links in new windows?')) { for(i=0; i<dll; ++i) if (window.getSelection().containsNode(dl[i], true) && linkIsSafe(dl[i].href)) window.open(dl[i].href); } } /* /mozilla */ if (!n_to_open) { /*ie, or mozilla with no links selected: this section matches open_all_links, except for the alert text */ for(i = 0; i < dll; ++i) { if (linkIsSafe(dl[i].href)) ++n_to_open; } if (!n_to_open) alert ('no links'); else { if (confirm('No links selected. Open ' + n_to_open + ' links in new windows?')) for (i = 0; i < dll; ++i) if (linkIsSafe(dl[i].href)) window.open(dl[i].href); } } })();
To make this work, open any page in Safari and then select the bookmarklet. One of the following things will happen:
IMPORTANT: If this doesn't work for you, ensure that you have Javascript enabled. You can do this via Safari > Preferences > Security.
One more thing - I have tried many times to get the above javascript to work as a Service in Safari (thinking that would be better than the bookmark approach), but have never been able to get it to work. On the off-chance you do, please share how. :)