This JavaScript module provides functionality for handling external links on a webpage.
Once initialised this package will check a site for any links pointing to an external source. It will in turn change their behaviour so that they are opened in a new tab. 'Opens in new tab' will also be added to the aria-label attribute of these links.
npm i @numiko/external-links
import { ExternalLinks } from '@numiko/external-links';
const links = document.links;
new ExternalLinks(links);
See documentation for more detail on how to use the package.