1

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();
	}
});
no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here
this post was submitted on 11 Jul 2023
1 points (100.0% liked)

Fediverse

28220 readers
167 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