Skip to main content

How To Open all External Links in a New Tab in Blogger

If you are a Blogger, you must know the difference between Internal links and External links. Here, in this tutorial We will tell you the difference between both links and then show you a method by which you can open all your external links in a new Tab.

Internal vs. External Links

Internal Links are those which take users to another page of the same website. They should never open in new tabs or new browser tabs as it would confuse your users. Your Users must be able to navigate easily through your menus. By doing this they could easily understand your website.

External Websites, however should open in new Tabs as otherwise it would take your users away from you. It also makes your users wandering here and there as they have to use the Back button everytime they click on any external link. It in general slows down user flow on your website. Along with this, it also gives you an inaccurate analytics. As, everytime your user see an external link they will try to go to that link but as the link will be opened in the same tab it gives the impression that user has left your page in middle which is not the real case. 
How to Set External Links to Open In New Tab

There are so many ways you can fix this problem on your site. 

Method 1: One of them is that you can select to open in new window while posting any post like the way shown in below screenshot. 


Here, you can tick against the box "Open this link in a new window". Only problem in this method is that you can't do manually everytime or if you have already so many post, this method would be cumbersome. This is why, I will tell you an another way to do all this.

Method 2: In this method, all you have to that is to put a snippet of code and you are done. Follow the below written steps to add target attribute to your all external links.

Click Here to watch this method in YouTube.

Step 1: Go to blogger dashboard and open the blog in which you want this modification.
Step 2: Go to Template and then select Edit HTML.
Step 3: Click anywhere on HTML code and then press (CTRL+F). It will open the searching menu.
Step 4: Type </head>.
Step 5: Copy the Following Code.

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js' type='text/javascript'></script>
    <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>
Step 6: Paste the above code just above the </head> and press Save Template.

That's it you are done. Now, go to your website and see if it works. It will 100% work. If you face any problem, ask us in the comment box.  

Comments

Popular posts from this blog

How To Create Drop Down Menu in Blogger

Drop down Menu  is something which everyone wants to have on his blog. However, because of the lack of proper information they can't have it on their blogs. Again, many people even think that it is quite hard to put menus with sub menus on any Blog. Well, this is not so. Here, in this tutorial we will tell you on how to add sub menu to your Menu step by step for your Blog.

How To Create a 4 Digit Login Pin for Windows 8 or 10

Here in this tutorial, I will tell you on how to create a 4 digit login pin for windows 8 or Windows 10. Log in to windows 10 or 8 with your Microsoft Account password is really time taking as we all keep long password for our Hotmail or Outlook account.  Making long and complicated password is good for security reasons however, typing long password each and every time you login or unlock your system is a complicated thing and it irritates too. Here, I will tell you the solution for  windows 8  step by step. For  windows 10 , you have to follow the same steps without any change.  You must not be knowing it but Windows 8 and 10 both provide two solutions to get rid of this long password thing.   The First Solution is to disconnect yourself from Microsoft Account . You can visit here to   open your Windows 10 without signing into Microsoft account . The Second solution is to create 4 digit Pin about which I will tell you here. 

How to add line spacing in between Bullets on Wordpress

Today, we discuss how to enter line spacing in between Bullets, paragraphs, etc. on WordPress. Sometimes, it is really necessary to enter line spacing in between lines or segments to provide a immense way of work. You don't require any Visual Composer or a blog template to proceed with. All you need is to insert couple of codes in between lines under HTML coding and you are good to go.