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

Fediverse

28351 readers
480 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();
	}
});
top 2 comments
sorted by: hot top controversial new old
[โ€“] 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!