Tuesday, 18 October 2016

You Like to Post Useful External Links, But Want to Keep Readers on Your Blog?

Nicki Edgell

Steps to Open all External Links in New Tab :

  • Go to your blogger dashboard
  • Select your blog >> Template
  • Backup your template before editing
  • Click on “Edit HTML”
  • Find </head> tag in HTML
  • Add the following piece of code just above the </head> tag
  • Save your Template, you are all done !!
Note : Please don’t add the red code if you already have jQuery library source code installed on your blog.
 <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>

Thankyou!

http://www.technotraps.com/

Please note that such scripts can sometimes yield unexpected results. If you do not have too many external links you can also set each individual one to open in a new tab via the link option available in your individual posts. This is actually what I have now done on this blog as I found that some internal links (specifically my featured posts and related posts also opened in new tabs using the above script when I didn't want them to). Before you know it you can have 6 tabs open which can be an annoyance.



About the Author

Nicki Edgell

I am a clinical Psycho-neuro-immunologist, Metabolic Balance Coach, Natural Nutritionist and Independent Nikken Consultant. I practice in Brighton in the South of England, helping individuals and groups towards the health, vitality and the life they want for themselves. I work under the principle that wellness depends on a balanced holistic approach to living, in all areas of your life: your body, mind, family, community and financial health all have an impact on your wellbeing.

0 comments:

Post a Comment

Powered by Blogger.

Statutory Notice: Although every effort is made to keep this information accurate and up to date this is not an official Nikken website. Registered trademarks® of Nikken appear throughout this site. Our Independent Nikken Consultants do not make any medical claims. Nikken products are not medical devices and may not be recommended to treat specific medical conditions. People who are in their first 3 months of pregnancy, or who have a pacemaker, health problem or electronic device (either implanted or external) should consult their doctor or manufacturer of the device before using magnetic products. Do not place Nikken's magnetic products in direct contact with magnetically sensitive items such as watches, video and audiotapes, computer discs, credit cards and portable electronic equipment. It is illegal for a promoter or a participant in a trading scheme to persuade anyone to make a payment by promising benefits from getting others to join a scheme. Do not be misled by claims that high earnings are easily achieved. Any personal data is not shared. Newsletter or blog followers can opt out at any time. If you sign up for my newsletter, which is administered through Mailchimp, I will store some of your information, including your email address, and certain information about the links you click within the emails I send you, on a Mailchimp server. Neither I nor Mailchimp will ever sell your email address or share it with any other party.