Open All External Links in New Tab Automatically in Blogger

Hello Blogger! We are always use manual method to external link open in new tab. Today i share a script with you that script redirect your all enternal link with a new window.
Open All External Links in New Tab Automatically in Blogger

How to use this code:

  • Copy below code, then go to your blogger HTML editor mode.
  • Then past this code before your </head> and save template.
  • Check and enjoy.

Code Box

 <script type='text/javascript'>$(document).ready(function() {

  $("a[href^='http://']").each(
    function(){
     if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  );

$("a[href^='https://']").each(
function(){
if(this.href.indexOf(location.hostname) == -1) {
$(this).attr('target', '_blank');
}
}
);
 
});
</script>

If you think this article helpful then share this aricle with other, who use blogger platform for blogging. Hope it's also helful for them.
Kashem Mir (born 05 Oct. 1998) is a Bangladeshi blogger author. He is the founder of Bangla Zoom. He's official Facebook fan page name "Kashem Mir". He started his blogging career in 20…

Post a Comment