Do you Know "How to Open all External Links in new tab or windows Automatically in blogger ? When you visit any blog or website, you may be see that when you click on a link it open a new windows. This is the very best idea used by webmaster because these way you can keep you user on your website. Web browsers also have option to open link in new tab or new windows but most of the internet user doing click the link directly and that way visitor loss your site and you lose valuable reader.
So here i provide you one code to enables open any external link in new windows or tab in blogger.
Automatically
External links open in a new tab or window automatically is very easy thing to do.
How to Install
- Log in to your blogger account
- click on the 'template' tab
- Backup your Template before making any changes to your blog (recomeded)
- Now Expand Widget Templates
- click on the "Edit HTML".
Now find this code
</head>
just paste below code above </head> tag
</head>
just paste below code above </head> tag
<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'/>
<script type='text/javascript'>
//<![CDATA[
jQuery('a').each(function() {
// Let's make external links open in a new window.
var href = jQuery(this).attr('href');
if (typeof href != 'undefined' && href != "" &&
(href.indexOf('http://') != -1 || href.indexOf('https://') != -1) &&
href.indexOf(window.location.hostname) == -1) {
jQuery(this).attr("target", "_blank");
}
});
//]]>
</script>
Save, then check the external link to test it , done!
Mannually
<a href="http://www.myblogtips.org/" target="_blank">
If you are do this manually Simply add the above highlighted code in your hyperlink. Adding target="_blank"> attribute to all external link may your site link automatically open in new windows or tab but adding this attribution. This is very lazy work because doing this you have add above code each and every time.
If you are do this manually Simply add the above highlighted code in your hyperlink. Adding target="_blank"> attribute to all external link may your site link automatically open in new windows or tab but adding this attribution. This is very lazy work because doing this you have add above code each and every time.