Hi,
I have a footer menu that has items with an external link. I want to open them in a new tab. For this, I added the following code to the theme.js file.
var links = document.links;
for (let i = 0, linksLength = links.length ; i < linksLength ; i++) {
if (links[i].hostname !== window.location.hostname) {
links[i].target = '_blank';
links[i].rel = 'noreferrer noopener';
}
}
I can see on the Inspect that the code has injected target=“_blank” and rel=‘noreferrer noopener’ to the tag.

However, the link is still not opening in a new tab. How can I solve this problem? I am using Motion theme.
Thank you.