Yesterday, I was posted a trick on how to add nofollow attribute to all external links automatically in blogger and today I bring another useful and helpful trick for all my blogger . In this post I will show you that how can we open
all external links into new tab. This can be done by adding simple
jQuery code into template. Opening external links into new tab help to reduce your blog bounce rate and
also you will not lose your valuable visitors. Now you have understood
the benefits of opening external links into new tab so let's begin the
tutorial.
Open External Links into New Tab
- Go to your blogger dashboard >> Edit HTML >> Tick Expand Widget Template Box
- Press Ctrl+F and find the below code.
- Now paste the below code above/before it.
- Save the template.
- Done!
</head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("a[href*='http://']:not([href*='"+location.hostname+"']),[href*='https://']:not([href*='"+location.hostname+"'])").attr("target","_blank").attr("title","Opens new window").addClass("external");
});
</script>
Note: Remove red line from code if you have already any jQuery.js file in your template.
Summary!
Always open external links into new tab to prevent your visitors go away
from your blog. If your visitors go outside to the external link than
it will increase your blog bounce rate and hurt your blog ranking. Try
to increase your blog traffic to maintain your blog ranking in search engines
Post a Comment