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








45 comments:
thankz alot for the script, is very easy!!
thankz alot~ is very easy to do
hi thanks mate, its very helpful for me, as i have tons of link i need to add target='_blank' before. you rocks man.
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!
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
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.
OMG I tried so many tips that didn't work and your tip was quick and easy. Thanks a million!!!
exactly what i was looking for! thanks :)
Absolutely perfect!! Thanks!
Exactly what I was looking for, thank you!
Tx, I was looking for this, very easy indeed.
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?
very cool and easy as pie - thanks allot
"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"
Thanks a lot of this, it works really well!
thanks for this one :)
Thanks! Worked like a charm! would definitely recommend ur blog ;)
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!
Thanks a lot. you are very helpful!
you are amazing :)
Thank you, yours was the easiest to understand.
Thanks for this very useful trick!
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
Should this change work in the Preview view ?
vrtulobjeq,
I wouldn't bet on it doing so, reliably. This change I would only test in a blog after published.
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 ?
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.
Thank you for your patience Chuck.
perfect! thanks
thanks
Thanks a lot. The tip is extremely useful and is extremely useful too. I've made the necessary changes on my blog .
thanks a lot...
i applied to my blogs...
its very good
thanks for u
this was helpful... your explanations are clear and easy to understand for the novice blogger
Thanks for the easy explanation!
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!
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.
I got it to work on my blog with no problem. It was exactly what I was looking for. Thank you!
Excellent, just what I wanted - thanks!
thanks for the
New window tut hehe
it works
http://finally-found.blogspot.com/
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
i have to say thanks for saving my times... lots of my times..!!
Thanks so much for this! Very helpful!
Thank you very much!
David
Perfect fix! Thanks so much. I wonder why Google doesn't want to provide this option?
Post a Comment