Saturday, February 02, 2008

Make All Links Open In A New Window

If you compose your blog, as I do, with lots of links to other blogs and web sites, you may make it convenient for your readers to view those other blogs or web sites then return to your blog. Instead of viewing the other blog or web site in the same window, you open the other blog or web site in a new window. When your reader finishes viewing the other blog or web site, he / she simply closes the new window. The article that he or she was reading, in your blog, is right there in front of them.

You can, similarly, do this with pictures. If you want your reader to view a picture, then return to the text in your article, you open the picture in a new window.

Instead of coding each individual link to a blog, picture, or web site, you can make all links within your blog open in a new window. Simply add a "<base target='_blank' />" to your blog, in the header.

Find
<head>

And change that to:
<head>
<base target='_blank' />

But, consider this carefully. If you construct your blog heavily using hypertext, as I construct my blogs, do you really want your readers having to close a window each time they finish reading a linked article in your blog? Do this with discretion.

While the reader is in your blog, give them one choice of what to read at any time. If they click on a link to read some detail, let them read the detail. Then, they click on the Back button, and return to where they left the previous article. Only if the reader is leaving your blog, to read another web site for detail, should you keep your blog open in the current window, and open a new window for the new web site.

Of course, if you have an insanely huge amount of links that you would like this way, maybe in a few linklists, you could host the linklists in another blog, and include the other blog in an iframe or maybe a series of posts linked to your public blog. Maybe including the iframe in your sidebar would work for you.

>> Top

184 comments:

cool lounge said...

thankz alot for the script, is very easy!!

cool lounge said...

thankz alot~ is very easy to do

music for soul said...

hi thanks mate, its very helpful for me, as i have tons of link i need to add target='_blank' before. you rocks man.

Thrifty Toddler said...

Thank you! I've been searching and searching online trying to figure out how to do this (I'm such a rookie). This is the only one easy enough for me to understand! :) Thanks again!

Aaron said...

Thanks for these instructions.

I implemented them successfully.

But I do have one question -- I like having most links open in new windows, but I'm not crazy about having the "Older Posts" and "Archive" links open in new windows. Is there any way to force these to open in the _same_ window? Thanks!

Sincerely,
Aaron Dalton
1GreenProduct.com

Chuck said...

Aaron,

What links do you want opening in a new window? The archives links will have to have the same policy as links in the posts.

You can make a separate blog, to contain linklists and such, and have a different policy for those links, but the blog which contains the posts and the archive links has to be the same.

Right now, I suspect, you're stuck with hand coding each individual link, to have archives and posts links work differently.

Virtuous Blue said...

OMG I tried so many tips that didn't work and your tip was quick and easy. Thanks a million!!!

Leanne said...

exactly what i was looking for! thanks :)

Matt said...

Absolutely perfect!! Thanks!

phurtive said...

Exactly what I was looking for, thank you!

Pedrofigo said...

Tx, I was looking for this, very easy indeed.

RuthWells said...

When I try this in my Blogger blog, I get 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 "base" must be terminated by the matching end-tag "".

What am I doing wrong?

Zen Tiger said...

very cool and easy as pie - thanks allot

gm said...

"Wah!! thankyou bro, susah bebenor nak cari camne nak buek natang ni... dulu dah buat tak jadi pasal silap sikit jer"

Translate..

"Wah!! thankyou bro, it was hard to find to find the coding how to make it.. last time I try but it's not working because of a litle mistake"

Adrian said...

Thanks a lot of this, it works really well!

Hobson said...

thanks for this one :)

Dipa Ghaghda said...

Thanks! Worked like a charm! would definitely recommend ur blog ;)

Bram Faems said...

Though i think it's better to add the target="_blank" manually (because not every link needs to be shown in a new window/tab) this tip helped me a lot with the website for my school.
Teachers who have little or no knowledge of html, are far better off now, then ruining my iframed website.

Thanks a lot!

Wanker said...

Thanks a lot. you are very helpful!

FabulousTerrah said...

you are amazing :)

vien said...

Thank you, yours was the easiest to understand.

Vagabond said...

Thanks for this very useful trick!

Julia Borsos said...

The code works very well for opening all links in a new window, HOWEVER there's an easy way to make only links in an article open in a new window.

I wrote a how-to aarticle on how to achieve this.

Great post btw :)
http://cyborgfrog.blogspot.com/2009/01/how-to-make-all-links-open-in-new.html

vrtulobjeq said...

Should this change work in the Preview view ?

Chuck said...

vrtulobjeq,

I wouldn't bet on it doing so, reliably. This change I would only test in a blog after published.

vrtulobjeq said...

Thank you Chuck, so how should I proceed after I publish my blog with the change and I find my blog doesn't work like it ought ?

Chuck said...

Vrtulobjeq,

I can see 2 choices for you:
1) Reverse the change (you did backup the template I hope), and find another solution.
2) Figure out what you did wrong, and correct your mistake.
Your choice, based on your priorities.

vrtulobjeq said...

Thank you for your patience Chuck.

Life Docket said...

perfect! thanks

YOGESH said...

thanks

Manish Ahuja said...

Thanks a lot. The tip is extremely useful and is extremely useful too. I've made the necessary changes on my blog .

Technologian said...

thanks a lot...

i applied to my blogs...

B.Tech ebooks and other said...

its very good


thanks for u

wroxton said...

this was helpful... your explanations are clear and easy to understand for the novice blogger

Jenne said...

Thanks for the easy explanation!

Kori said...

I tried this and got this message:

We were unable to preview your template
Please correct the error below, and submit your template again.
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 "head" must be terminated by the matching end-tag "".

I tried adding only the <{Code, apparently I can't post a comment with the correct code}> below {head} (commenting here is tough, it doesn't allow you to use any HTML code, I'm substituting parenthesis for the "<"), which made NO links click-able. I can click on anything and nothing happens. The pointer doesn't change either.

I also tried putting <{Code, apparently I can't post a comment with the correct code}> above {head}, and again, no links are clickable.

Any suggestions or ideas?
http://bubblykori.blogspot.com/

Thank you!

Chuck said...

Kori,

With the need to enter HTML, you'll be better off in an interactive forum like Nitecruzr Dot Net - Blogging. That's much better than Blogger commenting.

*Marie* said...

I got it to work on my blog with no problem. It was exactly what I was looking for. Thank you!

Victoria said...

Excellent, just what I wanted - thanks!

-BossinG- said...

thanks for the

New window tut hehe

it works

http://finally-found.blogspot.com/

koolstud said...

thanks ! great tip..I was searching for this for quite a long time.
Had no idea that it would be so easy to implement.
Finally it's working at my blog
http://requestbooks.blogspot.com

lenn0n said...

i have to say thanks for saving my times... lots of my times..!!

Conservative Brawler said...

Thanks so much for this! Very helpful!

David W. Nees said...

Thank you very much!
David

Daniel Elihu Kramer said...

Perfect fix! Thanks so much. I wonder why Google doesn't want to provide this option?

Mkcoy said...

Hey like Aaron I find that the "Older Posts" and "Archive" and "Comments" open in a new window/tab as well as external links. Has there been any development on this at all?

My blog uses external links as the post title so that's the only thing i want as _blank.

Let me know!

Lisa said...

Hey thanks...just what I needed!

Wasim Mughal said...

Hey!
I wasn searching the code to open all my links in new windows, I found that in your web!

But the last 2 paragraphs cought me, I think you advised well to the bloggers like me!

Regards for this kind advice!

Ънгер said...

Thanks. So simple, and yet - so genius!

Dana said...

Thank you so much for this. I've used it before but today I updated my blog to a new template and this code isn't working. Some links open in a new window, others do not.

Any thoughts? I pasted it right after the [head] code

Chuck said...

Dana,

I've seen hints that this setting isn't 100% reliable, but I've not seen any affinity that defines a problem. Have you yet posted a report in BHF: Something Is Broken? The online forums are much easier to use, then Blogger Blog Commenting, for interactive problem solving.

Tara said...

Your a legend!! Thanks heaps and heaps for this!!

Meanmachine said...

Wow i've been looking for this, and its working on my blog. Thanks!

paolociuchini@gmail.com said...

I have got the same problem as Mkcoy:

I d like external links in new windows and internal in the same..any solution out there?

The Unforgotten Cow said...

very helpful and useful tips for 'html blind' like me. many thanks.

The Unforgotten Cow said...

same problem as paolo and Mkcoy. I'd like to maintain the internal link in the same window.

Writer Bug said...

Thank you! Big help.

angelis said...

Wowww, thanks pal!
You saved me from loosing my blog readers!!
Cheers!

Bekah said...

Do you know how long I've wanted to do this? Not sure why I didn't google it long ago! THANKS!

the7thpwr said...

A great improvement indeed! Thanks :)

jblethen said...

I want links to open in a new tab, not a new window. How do I do that?

Chuck said...

The "New Tab" vs "New Window" selection is a local browser setting, and it's universal for that browser. It's not a setting that you can make, from your blog.

Xtreme_Blogger said...

thanx man.
really helped a lot.

Anya Kunnam said...

SWEET!!! THAT WAS FAST AND EASY! THANKS! GENIUS!

Statistics to Share said...

Just want to say thank you that was so easy!

Danielle Fabulosity said...

What a rock star you are! This was amazingly quick and easy. You've saved my bounce rate. Thanks a bunch!

Adrienne said...

Awesome! Good! Great! Simple!
other blogger advise I've read is long, complicated, applied to each individual link, pic, etc., and often doesn't work.

thank you and God Bless you.

AsiaParanormal said...

Hi there, you are amazing, this is the most effective and eazier code i seen. Awesome. thanks

Wong Alas said...

Good..........

nappy headed black girl said...

Wow...worked like a charm...thanks!

zein said...

thanks it is very nice, but i don't want to open all the links i want just specific links to open in you tab do you know how to make that

Chuck said...

Zein,

Coding specific links to open in a new tab or window (again, dependent upon browser setup by the readers) is a case by case HTML change.

KatieBug said...

Thanks! Easiest way I've read yet!! You saved me from a headache.

Shona Cole said...

thank you, it worked perfectly :)

Shona Cole
http://shonastudio.blogspot.com/

Lilith said...

Thanks, this is great!

Natalie said...

Thank you!

Cloggie In Training said...

Thank you! Super easy and worked perfectly! :)

BlackHat said...

although this opens all links in new tabs.. it opens too many in the long run.. If there was a way to only open external links form other sites to open in new tab that would be great...!! But is there a way to open images in new tabs..?? great post..

http://tweakblog-guru.blogspot.com/

Tia Fisher said...

Lovely and easy and works. I'll ask the readers which they prefer. Thanks so much.

Chuck said...

BlachHat,

Agreed. For many bloggers, this is not as useful as it could be. We're stuck with "Edit HTML" for all of our posts, and making bloglists in HTML gadgets, so we can add " target="_blank"" everywhere we need.

TheMuffinGirl said...

Thank you very much for this! I searched alot this information.

Marvelous Mommy said...

Wow that was the easiest thing I've done all day! Thanks!

Lorraine said...

Thank you so much!

serba asyik info said...

thank you very much for this

योगेश चन्द्र उप्रेती said...

Thanks a lot.,.,.,

Marie Panec - Panec4Congress said...

Awesome!

Maggie May USA said...

how to control the size? so it is smaller and doesn't block your first window

Chuck said...

Maggie,

I suspect that what you are thinking about is "pop up" windows, not regular display windows. Most people have their browsers configured to block "pop up" windows from untrusted sites.

When you open a link in a new window, that's a full size new window. The size of a new window is determined by current window size that you set, by dragging the browser window edges in and out.

d2r said...

works, thank you!

Al Ngullie said...

:) Thank you again so much for this, Chuck

jana * ^ _ ^ * said...

that easy?!
love it!
thanks soooo much for this!

Supia Chao said...

thanks a million to you.. You solved my problem.

Boschii said...

Thank you so much. This information was extremely helpful. Now I have to consider whether or not I want to continue using it because it also opens the individual pages of the blog in new windows : )

But that does not change the fact that this was extremely helpful information.

TY TY TY!

Susan Doran said...

Thank you -- I appreciate this sooooo much. It took me a few times to totally understand what you meant. For whatever reason--my own error most likely--I do not see anything that says header anywhere but I was able to add target=_blank in the url itself so it eventually worked. I had to keep pasting that in different parts of the html code for the link but as said eventually clued in. Thank you! I am finding blogger to be a drag and wish I hadn't started with them. I have a professional blog in wordpress and it's so much more versatile and friendly. best wishes

Purva said...

This is perfect thanks! Got it to work on my blog.
http://morado-purva.blogspot.com/

Sonal said...

You said "Simply add a ----------- to your blog, in the header." .But where is the header?Means what is it's pathway? Where i have to put this script? I'm a newbee. Please help me. I'm really in trouble.

azreen006 said...

Very simple & direct to the point. Thanks.

Chuck said...

Sonal,

Please ask this question in BHF: How Do I?, so we can address your needs most directly.

Sarith Thamuru Bartholameuse. said...

Thanks Alot ! You are genius !:) Thanx !

Joysze said...

Perfect! Thanks. :D

Boby Bratu said...

hey thx... works great... bobybratu.blogspot.com

Raghuveer said...

Thank you very much

Kashkreme Inc. said...

Amazing!!! Your Awesome that was Too SImple

Somogyvari Photography said...

YEEEES thank you

http://capetownweddingphotographer.blogspot.com/

kk said...

thanks!

OnlineCash4Free said...

Awesome tips! I didn't know you could do this with blogger. Thanks a ton!

DearDestini said...

Thank-you for your quick and easy instructions, that actually work.

Ross and Eva Heath owners of Heaths Old Wares and Collectables said...

G'day, thanks for such an uncomplicated code, it works a treat! cheers Eve, Heaths Old Wares Bangalow

Hilde van Dijk said...

Fantastic! Thanks. This was exactly what i needed.
Try to explain beginners to put target="blanc" in the HTML with every link the post ;-)

Zubair Mahsher said...

Hi mate, this is the best and easiest answer that I got it. I searched many times and found different tips which didnt work. Cool man . Thanks.

http://tunesofthoughts.blogspot.com

Nina said...

Many thanks to you!!

UAE Parassini Souhrudavedi said...

thanks..it worked well

gangqin said...

wew...thank's for it. It's easy.
GBU

the well being said...

wow!!! thanks for that. i can't believe it was so simple :-)

twon said...

That was easy thanks!

Nancy said...

Thank you! It worked instantly!
<a href="http://edityourhomemovies.blogspot.com</a>

Maurice Wilson said...

Thanks, this is great!

ashley said...

you are feaking amazing and I think I love you!!!!

SOTIR said...

Works great... Thanks a lot...

SK Seri Nilam said...

Thanks for the help.... Good script and simple...

Alexia @ Dimple Snatcher said...

SO EASY!! THANK YOU!!!!!!

Just A Car Geek said...

Amazing. Too easy. However, is there a way that I can get "older posts" not to open in a new window?

Mohamed hussein elshenawy said...

thanx alot

WildShan said...

Thank you VERY much. I just went through all of my historical posts adding the target="_blank" command. Ooof! You saved me a lot of work in the future! Much appreciated.

Jaime said...

Very helpful!

_alca_ said...

Big thanks my friend!!! All this time I had to write this _blank in order to make each link open in a new tab but now I don't have to! THANK YOU!

Otaku jack said...

great info and thx a lot man,your post help me alot

HLCouponLady said...

How do I access the header? I want all links to open their own pages but I just can't find where to insert that script to affect all of them...

HLCouponLady said...

Just got it! Lol

Satchel Pooch said...

Thanks for my first initiation to new blog windows. In my case, however, the placement of the command had to be changed, and put before each gadget to keep my top-of-page news feed ticker tape from expanding into a list of available news stories. (I got this tip from another site). I don't know why it happened, but the individual placements of your suggested command remedied it. You can check my top-of-page source code to enlighten me, if you have time. BTW, I'm new to blogging, so I'm limited in HTML programming at the present time.
Our-Potpourri-World.blogspot.com

Sara B said...

THANK YOU! I can't believe how simple that was. I'm so excited haha!

Connie Donlon said...

ah! you are THE best!
you saved me hours

Exit178 said...

Thank you sooo much!

Kathie @ Like A Box Of Chocolates said...

finally, a tutorial that works! thank you :-) I have been wanting to do this for a long time.

Sam Malizon said...

Thanks for the tutorial, it worked and its easy, thanks a lot

Ivy said...

THANK YOU!
I find it annoying when I visit a blog and the link opens in the same window and I have to keep going back.
I didn't want my readers to do the same.
I wish I could be an HTML wizard... glad you are out there helping.
Cheers~Ivy

SHAKA ZULU said...

Thanks. It's working.

Lauren Morris said...

yea! it worked!

THANK YOU!

Ganga said...

its 2011 and this blog post is still very useful.. thank u...

Jenn Erickson said...

Thank you so, so much for these instructions! It worked like a charm!

Jenn

Dhruv said...

dude, u rock.... it's working.. !! no body told this before...:)

Praznow said...

thanks so much

inTREsting said...

wow! im so loving it..thank you..

T said...

Thank you, thank you, thank you! I really appreciate the help.

pctricks-tips said...

SO how do we set open links in new tab? Because of its very convenient for user.

Chuck said...

Tricks,

We can only (at our option) set links to open in a new tab or window, as permitted by the browsers used by our readers. Our readers have the options to have the browser either:
1. Open "new window" links in a new tab.
2. Open "new window" links in a new window.
3. Ignore the "new window" modifier, and continue to open all links in this tab and window.

http://blogging.nitecruzr.net/2011/06/tab-window-management-is-controlled-by.html

Glowing Face Man said...

Wow, this was a lot easier than I expected it would be. IMO this is an absolute must for anybody using Disqus, since any links appearing in Disqus comments are set to open in same page unless overruled by something like this.

Angelgirlpj said...

Oh my goodness I did it :0) I've only messed with HTML code one other time and I prayed and held my breathe I did it correctly. You made it so easy. Now people can click on a link in my blog and still have mine open. Thank you so much.

MissionTumor said...

wonderful tip!
Thank you.

Sofia Lolain said...

"Aaron said...
But I do have one question -- I like having most links open in new windows, but I'm not crazy about having the "Older Posts" and "Archive" links open in new windows. Is there any way to force these to open in the _same_ window? Thanks!"

I was wondering the same thing, but about my pages widget. I've used the base target= method and I like it as I have a lot of links, but I want links internal to my blog to open on the same page.

If I'm on the Design>Html tab, and I tick "Expand widget", is there a way I can use your method but localise it to the widget block of code? Thank you so much.

Tham Khao Y Hoc said...

Thanks for your detail instruction regarding to HTML head code enable for link to open the new page.

Your information is very helpful and easy to follow.

Thanks again!

Parsuave said...

Thank! work easily.

punklace said...

Thank you so much! i dont know html very well but did this in seconds! thanks

C.H. said...

This is the simpliest solution to one of the most annoying problems with blogger!!! Thank you big time!

Wayne said...

It took some doing but I finally got it thanks

arjun said...

thank you so much - this is so great!! so much easier than coding every single link!

CastellCoruñas said...

Great!

I use Google feedreader on blogspot.com and with this all the links were opening in the same window.
Changing this involved a real lot of hassle with XML-sheets etc.

YOUR solution however was REALLY simple, a lot easier and quicker.

I am a happy blogger!

http://leo-joke.blogspot.com

Zuggernaut said...

Thanks for this post, it annoyed me to no end, putting in the target=_blank code for every hyperlink I wanted. I know you say to be careful, but I would much rather have a hyperlink open in a new window, then have it replace my blog! Point taken about giving them TOO many other windows open and distracting them from your blog.

Finally I decided to put your code in the header, mostly for the pure fact that is saves me grief from editing the code over and over for every hyperlink. Also, if the surfer is anything like me, and arrived at my page specifically to read my article, then I won't worry much about the other pages being open. Often I will surf to page a briefly to only find a useful fact that I am looking for, and that is fine too. (I have a Google extension that highlights your search term (usually only when it's a very specific phrase or term and lets you jump right to it, when you arrive on the page, interesting how it was programmed to know when I'm looking for quick info like that) Of course ctrl+f can also be used.

Also, I had written a post last year on my previous way of inserting the target=_blank code for individual hyperlinks which can be viewed here:
http://memeconstruct.blogspot.com/2010/09/how-to-make-links-in-your-blogger-posts.html

Cheers.

Saurav Chatterjee সৌরভ said...

you rock !!!
Love you!! was trying hard abt it since an hour n finally found your work to be helpful !!!
n was so so so easy to do !
-Saurav Chatterjee

International Agriculture and Development said...

YOU ARE AWESOME!! this was so simple and great for my blog. Thanks a lot!
Rafael

agdes.blogspot.com

Susan W. said...

Again...another easy tutorial where one isn't sent on a wild goose chase! Thank you!

Cecilia Tom said...

I was able to implement this in seconds. Thank you so much for the tip!

Pino Pausorio said...

Thanks very much for useful info, really needed ;)

Allan Nyhus, Formand GI40Hermes said...

Nicest!!

Starr Crow said...

I tried this and it worked great. I quickly realized that I didn't want it on my blog, but when I removed the code it continued opening all links in a new window. Any ideas as to what I did wrong?

Starr Crow said...

Nevermind. Problem fixed!

Parental Parody said...

Thanks so much - saved me huge dramas with this code, especially as I am now doing a number of sponsored posts and I would much rather all Hyperlinks open in another window, than lose my readers to the sponsor sites simply because they clicked a link.

జ్యోతిర్మయి said...

Thank you it helped me so much.

napetis said...

great tips, thanks..

Selectah Snipa said...

I came across this super late but hey it still works! Thanks a million for the tip. I'm now following too.

Ryan Byrne said...

Fantastic! Ive been meaning to do this for a while, worked straight up!
Thanks

CraftyEarthMama said...

Thanks for the clear, concise instructions!

Kush Agrawal said...

thanks buddy!

Valerie J. said...

Thank you for this. You really are the bees knees! What would we do without you!

saltvinegar said...

Thnks! I always think im losing visitors when i link to another website.Now its a lot easier for them to stay. Thnks!

Wendy H said...

Thank you so much, that was easy. Appreciate the information!

Norm said...

Great post, easy to implement. Thanks!

Kerang Laut said...

wow... tq bro!

Connie Gruning said...

THANK YOU!!!!!!!!!! this was so easy to understand and do!!
Connie

Jon Thorsen said...

Thanks...I'm trying to figure out a similar issue in that I would like clicking on a commenter's name to open that link in a new window...any idea how to do that?

I don't mind adding the target="blank" to other links that I want to open that way, but as you note changing all links to open this way can be a bit much.

Thanks!

Chuck Croll said...

Jon,

Customisable comment form code is not simple, and varies according to form style.

If you're using an embedded comment form, the comment code is part of the post template. Full page and popup window comment forms are not customisable, as part of the template.

To customise the code, you'll have to use the embedded form. However, the embedded form is bad for many blogs, depending upon who the reader population includes.

http://blogging.nitecruzr.net/2011/01/technical-sophistication-of-your-blogs.html

news said...

I have no idea how to thank U.

Stelios Kolomvounis said...

This way I make ALL the links in my blog to open in a new tab. However, I want only the links in my posts to open in a new tab. Is there a way for it?

Chuck Croll said...

Stelious,

To make only some links open in a new tab / window, you have to tweak the HTML on each link, one by one.

http://blogging.nitecruzr.net/2009/02/make-links-open-in-new-window.html