Friday, February 18, 2011

How to make all links open in new windows

This request to make all hyperlinks pops up every now and then so might as well make a post for it. To make all links open in new window is amazingly simple. Just sign into
DASHBOARD > DESIGN > EDIT HTML
to open template editor

Use keyboard shortcut ctrl+F to find <head> and immediately after that, add a single line <base target='_blank' /> so that it become

<head>
<base target='_blank' />

Save the edited template and viola, all links in your blog will now open in new tabs or windows.

Note 1: Blogger is now XHTML so all tags must have matching closing tags or be self closing. The above tag is self closing because it has that forward slash / at the end of the tag.

Note 2: This will cause all links including links to your own website to open in new windows. If you don't want this, then don't use this method.

Update: A commentator asked for all links to opens in a new window/tab, but then when other links are clicked, rather than opening another separate new window/tab, it replaces the one that was previously opened. So they can stay on my page while new links all appear in the same new window, not multiple new tabs/windows. This can be easily done by using <base target="_new"> instead so that it becomes
<head>
<base target='_new' />
I have tested it at Useful tools for bloggers and it works fine.


Note 2: Just wondering if adding a note for frequent visitors to set browser to open in new tabs rather than new windows will reduce the number of visitors having an unmanageable numbers of new windows opened. Do leave your opinions in the comments below:

Note 3: Some bloggers may prefer some links not to open in new window/tab but to open in the same window, Nute gave this tip to add the attribute target="_self" for those links you want to open in the same window/tab.

I have tested his tip at Safety Tips and Tricks (see Blogger Resources in the second right sidebar). His tip work correctly if the first and third link ("original Blogger Tips and Tricks" and "Blogger Book" opens in new window without the need to add target="_blank" and the second (Blogger for Dummies) opens in the same window by adding target="_self"

151 comments:

  1. thats right my master...
    http://www.w3schools.com/tags/tag_base.asp
    xixixi...\m/
    do u remember me??? hohoho!!!

    ReplyDelete
  2. Sure I remember you but you changed your profile

    ReplyDelete
  3. Is there a way of just forcing the link lists to opn in a new window rather than every single link? I don't really want my archive list nor my keywords list to do this, but it would be useful for external websites. I already add the "_blank" HTML into links I manually place within my blogs. Jon

    ReplyDelete
  4. Look at Making links in link list open in new window and if not clear let me know and I will probably write a new post.

    ReplyDelete
  5. thank you dear peter. let me go and try. and will come back and write the feed back.ok

    ReplyDelete
  6. Thanks will greatly appreciate feedbacks.

    ReplyDelete
  7. Dear Peter, Thanks for this tip which I stumbled upon today. I just started a new blog and am learning lots from you. Patty K.

    ReplyDelete
  8. sir, tahnks for the tutorial, but i found there is a problem when u are using the intensedebate comment in blog.. people fill up the comment and then click the submit button, and a new tab open, the response never made it...

    ive try to undo by deleting the html code, but it cannot happen as well.. can you please tell me how to undo this.. thank you

    ReplyDelete
  9. Hello!! Peter, I've done this will all my links even the page navigation links like older post newer post and older posts links also open in a new tab

    ReplyDelete
  10. code is well over my head. sorry, it wasn't useful

    ReplyDelete
  11. thank you for the great tip Peter, much appreciated!

    ReplyDelete
  12. aahh.. you just made my day!! :) THANKS!

    ReplyDelete
  13. Yep it is working fine but there has to be some option to make only sub links in new page..

    www.knowinfonow.com

    ReplyDelete
  14. I really hope this works! It has been a nightmare adding manually target= "new" every time I had a link :-)

    ReplyDelete
  15. I have a number of links which take visitors away from my Blog. Just implemented the code and now the links open in new window. Many thanks.

    ReplyDelete
  16. do you have a code code that will automatically make the links open to new tab for the Content of the Post Only..

    ReplyDelete
  17. Thank you so much for this information! It did just exactly what I wanted.

    ReplyDelete
  18. Thanks . EASIEST way ! Good job

    ReplyDelete
  19. Referring to Jon post, he is right, embedding the code directly into the blog html template will result all links to open in new tab/window including the 'archive list'. It is global, that is it affects the whole blog. It is better to add the code (target="_blank") in the blog post links.

    ReplyDelete
  20. Thanks & Nice
    Zahir
    http://notebd.com

    ReplyDelete
  21. Thank you for this. I have been wanting to open limks in a new window for a while but I have been afraid of wrecking my blog by doing something wrong with the html. This was really clear and straight forward :)

    ReplyDelete
  22. Thank you sir, for that your blog have help me in blogging for a long time. But i have a question for you sir, lets say, i have implement the all link open in new tab as above, i like it, but i dont want when they click on my page tab, they go to new tab also. can i make the page tab stays and change pages in the same window?

    ReplyDelete
  23. Its great!
    Improves my page impressions enormously !

    Thank you!
    http://hello-engineers.blogspot.com/

    ReplyDelete
  24. Admin, this particular post has the code that you seek. Are you saying it is not working for you?

    ReplyDelete
  25. Fay, this post is about making all links open in new tab/windows

    ReplyDelete
  26. mhmd Baden Powel, where did you read about Intense Debate comment as I have not mention it in this post?

    ReplyDelete
  27. Paul, the answer to your question is yes, all links will open in new tab or window

    ReplyDelete
  28. 2UrHealth, all you need to do is to get to the template editor and add this code

    <base target='_blank' />

    immediately after <head> so that it become

    <head>
    <base target='_blank' />

    You don't need to understand the code, you only need to know how to add it. Understanding can come later if ever.

    ReplyDelete
  29. mhmd Baden Powel,I am guessing that perhaps using inline CSS may get the tab to open in same window. May try to test that if I find the time

    ReplyDelete
  30. It worked, the first time. Thanks so much for the post. I add several links to my blog and it's a lot of work changing the html for every link. Your a gem:)

    ReplyDelete
  31. do you have a code that will automatically make the links open to new tab for the Content of the Post Only and not all the links.

    Thanks

    ReplyDelete
  32. Open new tabs? That is controlled within browser. 1, Try clicking in the mouse center button
    or
    2. Right-click on mouse and select Open link in new tab

    ReplyDelete
  33. LOL. This means you have not come across such code. I meant it would be nice if we can have a code that only opens the hyperlinks within the body/content post and not for the navigation page links.

    Waiting for that ingenious brain to find us a new tip for amateur like me.

    Thanks for the code, , , i'm still using it here http://governmentjobshere.blogspot.com/

    ReplyDelete
  34. THANK YOU SOOO MUCH!! THIS WAS SO UNDERSTANDABLE AND EASY TO DO!!! THANK YOU!!!

    Delina
    dewthis.blogspot.com

    ReplyDelete
  35. Excellent info!! Thanks for making the instructions understandable even for us non-programmers.

    ReplyDelete
  36. sorry for the late reply sir. I mean that when i use the all link open in new tabs before this, even my intense debate comment affected. i try to undo the html code, and delete what ive added but the html couldnt be saved. Then, i go the design tab, and change my layout and theme, then only did it work normally. i appreciate all your help and tutorial sir. thank you

    ReplyDelete
  37. ok..tq..i have try it..n it's works..
    ;)

    ReplyDelete
  38. Thanks, and especially for that note...

    ReplyDelete
  39. Fantastic! I just got this added to my blog. It will help readers be able to stay and finish reading the blog but have the links open and ready when they are. :)

    ReplyDelete
  40. Thanks so much for this. I didn't even know that it even existed! :)

    ReplyDelete
  41. its really really mind blowing trick..............visit my blog for Nokia secret codes http://besttipsntricks.blogspot.com/

    ReplyDelete
  42. Hi Peter,
    I linked your post in my blog
    http://www.ideepercomputeredinternet.com/2011/04/come-aprire-tutti-i-link-di-un-blog-su.html
    This is a very nice hack but it's against the rules of adsense. You can't open tha ads in another tab.
    Who has not adsense has no problem.
    Greetings from Italy and thanks for your posts.

    Ernesto

    ReplyDelete
  43. Easy peasy lemon squeezy!
    Thanks a million for this tip.

    ReplyDelete
  44. grazie molte !thanks!!

    ReplyDelete
  45. thanks!!!!!
    http://cracckers.blogspot.com/

    ReplyDelete
  46. Hi Peter! It's me once again...

    I've tried using target="blue" and it works

    The Kablogs Journal

    ReplyDelete
  47. for The Psalmist,

    Putting target="blue" means you want the link to open in a tab or window called "blue" eg if you specify that target="new, same, it will open in a new tab or window called "new"

    ReplyDelete
  48. All I can say is.... YOU ROCK!!! thank you SO much! Everything else I read was SO complicated... I did what you wrote and VOILA! it was finished! Again, thanks! you rock!

    ReplyDelete
  49. Thanks Peter, worked like a charm and I didn't even know I needed it until I read this post! You're the best! Hugs!

    ReplyDelete
  50. Thankyou so much!! This had been really bugging me! Lols. You're totally P-awesome! ;) M x x

    ReplyDelete
  51. Thank you, Peter! I'll be coming back often...

    FWIW, I *always* have my Firefox to "Open new windows in a new tab instead"... Never thought to post it on my blog though. (I don't have any visitors yet...)

    ReplyDelete
  52. It was a very useful tip for us at cultural synergie

    Many thanks, keep it up

    ReplyDelete
  53. Hi Peter,

    I used your code until I notice that also internal links open in a new tab. So I searched and I've written this one to open all external links in a new window: http://goo.gl/Dphpj

    I've commented it with some web designers and everyone said me that is an horrible method that scary people and very user un-friendly because you lose the "back" button (http://goo.gl/CNVUL). What do you think about it?

    Thank you!

    ReplyDelete
  54. Note that at the beginning of this article, I have posted "This request to make all hyperlinks pops up every now and then so might as well make a post for it." so it is mainly because many bloggers want it.

    Regarding no "Back" button, I think it is not a concern because once you close the new tab/window, you will be taken to the referring tab/window or at least that would not have been closed and still available in your browser.

    As to whether it is good, there is even controversy over making any link open in no tab/window with some advocating not even a single link open in new tab/window. For me, I often prefer to open links in new tab/windows and just close them if I don't need them anymore and that is my personal preference.

    ReplyDelete
  55. I prefer to open in a new window/tab too, but most people in the reddit post (mentioned above) said that should be the user to decide it and don't confuse it, otherwise you will lose users.

    I know that you mentioned that all links will open in a new window, but I see that here there are some bloggers that want only external links to open in a new window, that's why I wrote my solution. I hope that it could be useful for all of you.

    Thanks to all!

    ReplyDelete
  56. hi Uncle..
    i ve sum links to MP3songs in my page..
    i want (ONLY) them to open in a new window..

    oh, u remember me.. d same guy who was making a new blog every single time (guinness record fr most no of blogs :P) he blogged instead of postin in 1 single blog.. :D
    m a big fan of urs nw.. :)
    kayy

    ReplyDelete
  57. What is the code you use? Perhaps you can add the attribute target="_blank" to the code you can get what you want.

    ReplyDelete
  58. I have been blogging for 3 years with blogger and NEVER KNOWN how to do this. You have quite literally changed my life. Thank you!!!!!

    ReplyDelete
  59. Hi from me too, Peter,
    I read through the comments but I didn't see whether this code affects Google Adsense links. If it does, that's a bad thing. Please share your experience on that, as it is not advisable to experiment with this sensitive issue. Does this code make Adsense links open in new tabs/windows? Or do they open in IFRAME by default?
    Also, what if this code is placed after the "body" tag - will it affect only the links which are in the body of the blog?

    I tried some links around your blog - not all of them open in a new window. What solution do you use for your blog?

    Greetings from Bulgaria :)

    ReplyDelete
  60. Check out Google Pack Components which I used to test implementation and confirm for yourself that clicking on Javascript does not open in new windows.

    ReplyDelete
  61. Thanks very much brother it run smoothly.
    http://tipwithtrick.blogspot.com/

    Good Luck!

    ReplyDelete
  62. Thanks so much for this post! I had no idea it would be that simple.

    ReplyDelete
  63. For those who are using this tip and have a few links on the page that they want to open in the window/tab, and not a new window/tab, you can override the behavior of individual links by adding a target="_self" to the A tag. This will cause that link, like your HOME link, to open in the same window.

    ReplyDelete
  64. Many thanks to Nute. I have tested his tip at Safety Tips and Tricks (see Blogger Resources in the second right sidebar). His tip work correctly if the first and third link ("original Blogger Tips and Tricks" and "Blogger Book" opens in new window without the need to add target="_blank" and the second (Blogger for Dummies) opens in the same window by adding target="_self"

    ReplyDelete
  65. Thanks man.very good tip

    ReplyDelete
  66. You are a genius. Thank you... and I'm on the upper luddite html scale. I now feel smarter that I did it and it worked. AWESOME!!!! Peace & Love, @thestorysmith on twitter, blog: The Storysmith

    ReplyDelete
  67. Thank you so much! It worked. Awesome.

    ReplyDelete
  68. Thank you! Just what I was looking for and really easily explained. Brill!

    ReplyDelete
  69. I need all the help I can get as I'm new to this blogging game! Thank you SO MUCH, it worked first time. Super easy to do, awesome as!!


    http://vee-travels.blogspot.com/

    ReplyDelete
  70. I did it but I have pages on my blog and now if people click around they end up with tons of open windows. So it doesn't work for my blog. How do I do it individually with each link?
    Shena

    ReplyDelete
  71. Have a look at How to make active link in post (ignore the part about making links in comments because the attribute target="_blank" is not allowed.

    ReplyDelete
  72. thank you soooooooooooooo much

    ReplyDelete
  73. Worked a treat thank you very much :)

    ReplyDelete
  74. Wow this such a great article and the tips are very comprehensive. For sure many entrepreneurs with small and big businesses are going to benefit from this. Keep it up!

    sign printing"

    ReplyDelete
  75. Oh wow, thanks so much!!!! Been trying to find something like this for ages... finally all my links open in new windows, thanks so much! you're a blog saver!
    Karen Xavier

    ReplyDelete
  76. Very nice sharing guys more like that on http://www.tutorialsworkshop.com

    ReplyDelete
  77. I have so nice best friend quotes, and with funny for boys and girls there in my website. “Our best friends understand always, when we said forget that. Waiting forever while we say a little while. Said while we said leaved me alone. And after open the door you can say come in.”

    ReplyDelete
  78. thanks a lot man.. great tip... so simple... god bless you.

    ReplyDelete
  79. Hi,
    I would like to set mine so that the first time a visitor clicks a link in my blog it opens in a new window/tab, but then when other links are clicked, rather than opening another separate new window/tab, it replaces the one that was previously opened. So they can stay on my page while new links all appear in the same new window, not multiple new tabs/windows. Thank you!

    ReplyDelete
  80. Use attribute target="_new" instead.

    ReplyDelete
  81. hi,

    Is there a way to make it so links to external sites open in new tabs but ones which just link to other pages in my blog open in the same tab?

    thanks

    ReplyDelete
  82. Perhaps that can be achieved using conditional tags but I am at a loss for the moment what conditions to apply

    ReplyDelete
  83. I'll have a look into conditional tags

    thanks very much

    ReplyDelete
  84. Hello, using 'new' works great! Easy, but I was really only hoping to apply this to my pages/tabs. Where in the HTML code would I need to add this line?

    Thanks!

    ReplyDelete
  85. Hi, How to make only outside link to open in new but not own site links.
    For exp my own site links in post/sidebar etc should open n same in windows but all other outside link in new tab/windows.

    ReplyDelete
  86. You can only do that manually

    ReplyDelete
  87. manually? but how for sidebars?
    I can do in post easily with your tips above.

    ReplyDelete
  88. For own site target="_self" or target="_new"
    For outside target="_blank"

    Any words can replace new

    ReplyDelete
  89. thanks peter... my blog is http://tdsolomons.blogspot.com/ it has about 45 views a day. can you please take a look at it and suggest me few tips to increase its views. i'll greatly appreciate that.

    Regards.

    ReplyDelete
  90. Write good content and for human to read and not just for search engines which may make it artificial.

    ReplyDelete
  91. Thanks for your advice Peter.., i'll try :-). thanks for your time..
    I have another Question ; i have some posts ranked 1st on google search results . will it effect that rank if i do some edits on those posts..?

    Regards.

    ReplyDelete
  92. I don't think so, but it depends on how extensive the editing is. In any case, search engines are notorious for being fickle and changes without notice.

    ReplyDelete
  93. But since you got ranked number 1, I wouldn't mess with it if I were you.

    ReplyDelete
  94. Thanks Peter.
    I just want to correct some errors in those posts and to make all the links in those posts open in new tabs as you've discussed on this topic.

    ReplyDelete
  95. Thanks a lot Peter...

    ReplyDelete
  96. Thanks a lot this helped me much........!!

    ReplyDelete
  97. Thank You very much Peter... :)

    I have try the code and it works just fine :D

    what I want to ask right now is.. How to make this happened but only for the link on my post not all the link in the page ?

    where should I put the code so I don't have to add target='blank' or 'new' in every link in my post. Should I put it in body area or more specific in the post area ?

    Thank you.. :)

    ReplyDelete
  98. thank you,
    i did it and now my links open in new window.
    but google adsense ads are open same window. what to do?

    ReplyDelete
  99. Adsense uses Javascript and they don't allow tempering of their script.

    ReplyDelete
  100. Do you happen to know how to make a specific page (from your blog's tabs) open in a new window?

    ReplyDelete
  101. Hi peter..i need a small help in this new tabs..i embedded ur code & its working fine in my blog..but the prob is even my home page menu tabs are also opening in new tabs which i dont want..all the remaining links except menu tabs need to be opened in new window. can u help me by telling solution for this..waiting for ur reply

    ReplyDelete
  102. Thank you for posting this! My problem now is that all my Blogger Page/Menu Tabs are all opening in other windows. If someone views all my tabs, they will have 6 windows open! Is there a way to have only hyperlinks open in a new window and not the menu tabs?
    Thanks for your help!

    ReplyDelete
  103. While not exactly what you want, why don't you try the update in this post which will make all hyperlinks open in the same new tab or window.

    ReplyDelete
  104. thank you for the suggestion! Do i post it on every page or just the template html?

    ReplyDelete
  105. Is there any way to change the post title link to my private web address for all post

    ReplyDelete
  106. Sign into Dashboard > Settings > Formatting
    and tick "Show link field. Then when you publish a post, put the private web address (URL) into the link field. See Test link field and verify for yourself that the link will send you to this blog.

    ReplyDelete
  107. My problem is also:

    That all my Blogger Page/Menu Tabs/older post are all opening in other windows. If someone views all my tabs, they will have many windows open! Is there a way to have only hyperlinks open in a new window and not the menu tabs?

    I want all EXTERNAL link to open in new window, not the one in the blog!

    ReplyDelete
  108. There is a way but I am not expert at it. How about this, for all links to open in new window, then the next click will open the same window. Check my update:

    Update: A commentator asked for all links to opens in a new window/tab, but then when other links are clicked, rather than opening another separate new window/tab, it replaces the one that was previously opened. So they can stay on my page while new links all appear in the same new window, not multiple new tabs/windows. This can be easily done by using <base target="_new"> instead so that it becomes
    <head>
    <base target='_new' />

    ReplyDelete
  109. This has been very useful for me. Thank you very much ^_^

    ReplyDelete
  110. After I put this code into the HTML, I can not take it out. I'm now getting this error message: Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The element type "body" must be terminated by the matching end-tag "/body"
    Error 500

    There is clearly an /body end tag in my blog. Any advice?
    Thanks!

    ReplyDelete
  111. It should be </body> and not "/body"

    If you already know this, did you backup the template. If so revert to backup template and start again.

    ReplyDelete
  112. Hi Peter, I just want to make the links in a link list open in a new window. I see that you have instructions for this but my template does not have the option to "edit template or expand widget" under layout.

    Would you mind taking a look at my blog and advising me? http://luvachicken.blogspot.com

    Thank you, Dorothy

    ReplyDelete
  113. Sign into www.blogger.com
    Dashboard > Design > Edit HTML

    ReplyDelete
  114. Thanks Peter. Its working!

    ReplyDelete
  115. Excellent! Thanks

    I share my flickr photos on my blog and previously when the photo link was clicked you were taken to the flickr page.

    Now, with you great tip a new window/ tab opens.

    Thanks

    ReplyDelete
  116. Thank you so much! This saves so much time and helps me from forgetting to click those little buttons!

    ReplyDelete
  117. Thank you for sharing
    http://www.watchesclass.com/tudor-replica-watches.html

    ReplyDelete
  118. hey...
    can is it possible to enter an html code on my blog,
    so when e new tab opens,it runs on the background so i can continue watching the first tab???
    thanks
    gio

    ReplyDelete
  119. Thank you! It really works.

    ReplyDelete
  120. Thanks. This sure helped with my blog. (www.idefineit.blogspot.com)
    :D

    ReplyDelete
  121. this also help for my blog www.newgamesforfree.blogspot.com

    ReplyDelete
  122. Thanks so much for this! I'm glad I saved your page. I just updated my template and forgot to add this to it. Luckily I remembered about this tip. Such a big help!

    ReplyDelete
  123. Thaks you so much, you are a genius, It really works. i love your blog :)

    ReplyDelete
  124. can yo tell me this,i am taking your website only as my example. how did you make your labels open in your website and how have you edited information inn the particular labels!!
    .
    if you can give me the answer i will spread my friends about your blog truthfully..
    if yo know the answer please send it it to akshay.a.crazy6@gmail.com

    ReplyDelete
  125. Well this post is about making all links open in another tab or window

    ReplyDelete
  126. I want to thank you SO much for this tutorial. Its so simple and effective- just what I needed for my blog. I'm thrilled!! Thanks again!

    ReplyDelete
  127. Thanks for this. Is there a way to ignore all Linkwithin links or Outbrain?

    ReplyDelete
  128. There are some codes which makes only links to external sites open in new tabs/windows but I haven't got to start writing about it yet. Perhaps later.

    ReplyDelete
  129. hi peter good post.... i hav a smal problem with my blog ababbol.blogspot.in my blog posts are opening in new tabs . . im new to blogging. can i make it.. plz giv me som tips..

    ReplyDelete
  130. Hi, tanks for the great tips however i cant get my blogger blog pages to open in another tab, can you pls help!
    My blog is http://www.sebamedskin.blogspot.com

    tanks for all your help

    ReplyDelete
  131. Are you referring to this particular post to make all links open in new tabs/windows?

    ReplyDelete
  132. Sebamed, is your problem links in your blog opening in new tabs without you doing anything or is it it ain't and you want to make them open in new tabs?

    ReplyDelete
  133. Works perfectly! Glad to have some across this post. Thanks for sharing this trick. Very helpful! :)

    www.themommist.blogspot.com

    ReplyDelete
  134. THANK YOU
    THANK YOU
    THANK YOU
    I WAS GOING TO DO IT MANUALLY FOR ALL MY LINKS.
    THANK YOU

    ReplyDelete
  135. then, for a popup window???????????????????

    ReplyDelete
  136. exactly what I was looking for! Thank you.

    ReplyDelete
  137. my all internal links open in new tab.i have also used target_self but it can't work.pls tell how to fix this problem?????

    ReplyDelete
  138. thanks, it really works
    see http://entrr.blogspot.in/

    ReplyDelete
  139. Does this work with adsense ads?

    Thanks!

    ReplyDelete
  140. I tested that and no, it does not work with AdSense ads.

    ReplyDelete

Find help, info, instructions, tips, tricks

Tip: Use search box below or this box, labels in the first right sidebar, archive, ctrl+F for this page or sitemap to find topics