Adding target_”blank” to all links (with javascript)
-
Hi,
Someone told me I can use the javascript below to convert all external links to open in new tab.
jQuery(document.links) .filter(function() { return this.hostname != window.location.hostname; }) .attr('target', '_blank'); Read more: https://html.com/attributes/a-target/#ixzz5dpkM3QDM
Where do I put the code? In the header part? In the footer?
I have a plugin that allows me to put code in those parts (and in before/after post)
Thanks
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- The topic ‘Adding target_”blank” to all links (with javascript)’ is closed to new replies.