Hi, I'm looking for a way to force all users links in all bio to open in a new tab.
Could you help me to understand how I can do?
User bio is not supporting this, how can I implement it?
I tried to put in the footer a script but is not correctly and fully working with user bio extension
<!-- Open external link in a new tab -->
<script>
window.addEventListener("DOMContentLoaded", function externalLinks() {
var anchors = document.getElementsByTagName("a");
for (var i = 0; i < anchors.length; i++) {
if (anchors[i].hostname !== window.location.hostname) {
anchors[i].setAttribute("target", "_blank");
anchors[i].setAttribute("rel", "noopener");
}
}
});
</script>
Maybe I should insert this script in the extension?
I need some help to resolve links opened in the same window.
I have the SEO extension but doesn't work for external link in a new tab for user bio.