HTML Code To Make Link Open In A New Tab


You dont have to use target='_blank' tag again in order to open link in a new tab, here is a piece of code that will help you do just that.

How to install:
Copy the bellow code and paste it before </head> tag (between <head> and </head>) of your blog/site
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<!-- Script By http://www.TechInfoPortal.com/ -->
 <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>
Save and Exit, Now check and see how it works. 
Happy blogging

Comments