chore: do not test for hostname
This commit is contained in:
parent
c3ff391968
commit
337b0cc14c
|
|
@ -3,10 +3,7 @@ export const setExternalLinksToOpenInNewTab = (
|
|||
) => {
|
||||
const httpRegex = /^https?:\/\//i;
|
||||
anchors.forEach((anchor: HTMLAnchorElement) => {
|
||||
if (
|
||||
httpRegex.test(anchor.href) &&
|
||||
!anchor.href.includes(window.location.hostname)
|
||||
) {
|
||||
if (httpRegex.test(anchor.href)) {
|
||||
anchor.setAttribute("target", "_blank");
|
||||
anchor.setAttribute("rel", "noopener noreferrer");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue