this post was submitted on 11 Jul 2023
9 points (100.0% liked)

Fediverse

28387 readers
847 users here now

A community to talk about the Fediverse and all it's related services using ActivityPub (Mastodon, Lemmy, KBin, etc).

If you wanted to get help with moderating your own community then head over to !moderators@lemmy.world!

Rules

Learn more at these websites: Join The Fediverse Wiki, Fediverse.info, Wikipedia Page, The Federation Info (Stats), FediDB (Stats), Sub Rehab (Reddit Migration), Search Lemmy

founded 1 year ago
MODERATORS
 

I wrote a quick script that opens links to external sites in a new tab. It works everywhere, not just on lemmy.world. You need a browser extension to embed custom javascript to use it.

document.addEventListener('click', evt => {
	const href = (evt.target?.tagName === 'A' ? evt.target : evt.target?.closest('a'))?.getAttribute('href');
	if (href && !href.startsWith(location.origin) && href.match(/^(?:https?:)?\/\//)) {
		window.open(href, '_blank');
		evt.preventDefault();
	}
});
you are viewing a single comment's thread
view the rest of the comments
[โ€“] Kovu@lemmy.world 5 points 1 year ago (1 children)

why not just middle mouse click?

[โ€“] countstex@feddit.dk 2 points 1 year ago

It can't be that eas.... Well damn!