jQuery(document).ready(function() { "use strict"; // Add target _blank to all external links var mndomain_check = document.domain.replace("www.",""); jQuery("a[href^='htt']").not("a[href*='"+mndomain_check+"']").attr("target","_blank"); jQuery("a[href$='pdf']").attr('target','_blank'); });