Make A Link Opens In A New Window or Tab
We sometimes put links in our posts. And naturally our visitor will click on those links. By default when a link is clicked it will open in the same window.
If your blog is like mine where visitors only come in once in a blue moon ha-ha, keeping them in your blog once they come in is crucial. We wouldn't want them visitors disappear from our blog through outbound links, now would we?
But don’t worry guys, we can prevent or at least delay this by opening the links in a separate window or tab. This can be achieved by giving the appropriate value for target
attribute in your link’s HTML.
I. Two methods of opening a link in a separate window (or tab)
Use the code below:
<a href="YourLinkUrl" target="windowname">anchor text</a>
where windowname is the name of your target window. (Note: Anchor text a.k.a link text is the visible part of the link , the one you click on).
- Method 1: Replace "windowname" with
_blank
, like so:<a href="YourLinkUrl" target="_blank">anchor text</a>
Using this method, a browser will open a new window or tab each time you click the link. If you click 3 times, it will open three windows. -
Method 2: Replace "windowname" with a name of your choice, like this:
<a href="YourLinkUrl" target="MyNewWindow">anchor text</a>
With this method, a browser will open a new window named MyNewWindow (or whatever name you give). If the window doesn’t exist, it will create one. If you click 3 times it will still open just one window –the window you specified. You might want to use this method if you want to limit the number of windows opened.
II. Setting a default target window
The two methods above are for individual links, which means you have to specify the target window for each link one by one.
There is a simpler way though, using <base>
tag target
attribute. The <base>
tag target
attribute will set the default window for the whole page. Put this tag after the <head>
tag at the top of your template HTML. For example if you want to open all links in a new window named MyNewWindow then the code will be like this:
<base target="MyNewWindow" />
To open in a new window, replace MyNewWindow
with _blank
.
And of course, if you do specify the target window in an individual link after this, the new target window will override the target window specified by <base target…../>
tag (for that particular link).
Update 1: Blogger (blogspot) LinkList gadget
In Blogger Help Forum, people always ask how to open LinkList links in new windows. Okay this is the answer:
- Go to Template > Edit HTML.
- Click inside the code window and press Ctrl+F on your keyboard. A search box will appear in the upper right corner of the window.
- Find the following code using the search box. This code is a part of LinkList gadget's code:
<li><a expr:href='data:link.target'><data:link.name/></a></li>
-
Finally, insert
target="_blank"
inside thea
tag, like this:<li><a expr:href='data:link.target' target="_blank"><data:link.name/></a></li>
Update 2: Blogger (blogspot) Pages/PageList gadget
To open pages in new windows, follow similar steps to that of a LinkList gadget above. However, look for this code instead:
<li class='selected'><a expr:href='data:link.href'><data:link.title/></a></li> <b:else/> <li><a expr:href='data:link.href' ><data:link.title/></a></li>
and insert target="_blank"
inside both a
tags, like this:
<li class='selected'><a expr:href='data:link.href' target="_blank"><data:link.title/></a></li> <b:else/> <li><a expr:href='data:link.href' target="_blank"><data:link.title/></a></li>
Note: Setting a link to target="_blank"
tells browsers to open it in a new window. Now whether the link opens in a new tab or in a new window, that depends solely on each user’s browser setting.
Update: Many readers asked me for this, so here it is: How To Make Only External Links Open In New Windows
Enjoy!
213 comments to "Make A Link Opens In A New Window or Tab"
«Oldest ‹Older 1 – 200 of 213 Newer› Newest»With what are you replaceing ”yourlinkurl”?
I'm a newbie. Thanks
Yourlinkurl is the link (address)you want to go to when you click it.
Do this:
Move your mouse pointer over your name "Antimorfeu" in the comment box above. Now see the texts in the status bar of your browser (at the bottom of your screen)? It should display "http://www.blogger.com/profile/13511920061884683078". In this example this is yourlinkurl, it is the address of your Blogger profile. And "Antimorfeu" is the anchor.
Greenlava, thank you very much. I'll give it a try
Hi there! I'm a newbie. I understand your directions about adding a link within your post that will open in a new window. What I'm trying to figure out is how to open new windows when choosing the links in my link list. Could you give me some advice on that?
Thanks so much.
Hi Vicky,
Thank you for visiting my blog. To answer you question, you have two options:
1. Use base target="_blank", but using this will also affect links (the ones that aren't target specified)
2. Go to Layout>Edit HTML,check the Expand Widget Templates checkbox, and look for this line of codes:
Note: I'm replacing < and > with ( and ) to avoid error in here.
(b:widget id='LinkList1' blah blah...), the id no. may differ (in your case it's Linklist10 and Linklist2 if I'm not mistaken).
Now a few lines down below you will see this:
(li)(a expr:href='data:link.target')(data:link.name/)(/a)(/li)
You want to insert the target _blank tag here, making it look like this:
(li)(a expr:href='data:link.target' target='_blank')(data:link.name/)(/a)(/li)
That's it!
Wow! That was easy. Thanks so much. I'm sure I'll have more questions later.
Thanks again!
This is all over my head.
I have a blogspot blog and I want my links to open new pages. I tried your instructions and I was unable to get it to work.
Can someone help me?
Don't mention it. Come back anytime..
Hi Simpleman95,
Looking at you blog I suggest you use:
Note: I'm replacing < and > with ( and ) to avoid error in here.
1. Go to Layout>Edit HTML, and look for this line:
(/head)
2. Paste the code below, just before that line
(base target="_blank" /)
3. Click Save Template and view your blog.
All your links by now should open in new windows.(at least in your acousticreviews blog)
Give it a try and tell me if it works or not.
Thanks for visiting
Thanks
Hey, I followed your advice and it didn't do anything.
Any idea why?
I am specifically trying to do this for my acoustic reviews blog, not any of the others.
Thanks so much for your help so far. Let me know what you think.
@Simpleman95,
You should put the code inside "<" and ">"
Thanks
Now it worked.
Thank you so much for your help!
I really appreciate it.
Hi Greenlava,
I tried your suggestions and I got the error message "Your HTML cannot be accepted: Attribute "TARGET" is not allowed". And then it told me: Sorry, the page you were looking for in the blog xxx does not exist. and another time it told me that "http" was not allowed in the html.
Any tips? The blog in question is: http://deirjoeybloggs.blogspot.com/
Thanks for your great blog.
Hi Aisling Ní Acamé,
What is the link you're working with? Is it the
www.aislingniacame.blogspot.com?
First of all the link should be http://aislingniacame.blogspot.com
To open it in a new window, use this:
(a href="http://aislingniacame.blogspot.com" target="_blank")http://aislingniacame.blogspot.com(/a)
Please replace "(" and ")" with "<" and ">" respectively.
Thanks and welcome to my blog.
Hi again Greenlava,
Thanks for your message. I tried it and got the error message
Your HTML cannot be accepted: Attribute "TARGET" is not allowed:
lg,
Aisling
@Aisling Ní Acame,
I've understood why.
You're putting the link inside your profile gadget, that's why.
You have to omit target="_blank" if you want to put links in there.
But if you still want it to open it in a new window, try "base target="_blank". But remember this code will open all (unspecified)links in new window, not just that one.
Please read my previous response to Simpleman95.
Thanks,
Thank you, Greenlava!
The base target attribute works great.
You're welcome laja...
Hi Greenlava, just wanted to say thanks. I have a new blog - visitnorthumberland.blogspot.com -and wanted the linklists to open in new windows as well as the links in the body of the posts (which I'd figured out). Anyway, did a google and found your blog, and now I've been able to edit the html and get the linklists opening in new windows too! Thank you.
My pleasure Sheelagh
Hi Greenlava, now I am stuck. I am trying to add a widget (gadget?) containing an external (BBC weather) feed to my blog and this is one thing I cannot get to open in a new window, even if I place the target blank coding after the expr etc text. Any suggestions? I can add the widget if you want to take a look at the coding. Let me know. Thanks again. Sheelagh
Sheelagh,
Have you tried base target="_blank"?
Yes, please add in the widget.
BTW did you add target="_blank" to all the links one by one?
Hi,
What does base target="blank" mean?
I tried adding it like this: base target='_blank'
and it didn't work.
But I have added the widget if you'd be kind enough to take a look at it?
Out of curiosity, has anyone figured out how to get goole ads to open in a new window?
Many thanks, Sheelagh
base target="_blank" is explained in the article, under Setting a default target window.
The BBC weather feed widget specifies target="_self" and Google ads specifies target="_top".
Both will open in the existing window. Even if you use base target=_blank", they will still open in new windows because their settings override the default created by base tag.
I guess you just have to leave these two links as they are :(
OK, sorry, I see what you mean. So really there is no way around it? If I have the feed it will open in the existing window and the visitor will move out of my blog?
I don't think there is a way around it.
But do you know there is a weather widget in Blogger Add A Gadget listing?
In Page Elements, click Add A Gadget. In Add A Gadget window, click Most Popular at top left of the window. The weather widget is the first item on the list.
This widget does open in new window.
you are the daddy, great tips man
Thank you and don't forget to come back.
I tried and succeed with base target = _blank
Thank you so much.
by the way, are there any different automatic way to open external links in new tabs (not internal links)
Thanks!
Here my blog is:
http://book4fun.blogspot.com
You're welcome.
The same method applicable to external links too.
This is very helpful, I've just used this on my blog! I subscribed to you! :D
One question, is it possible to have exception links for this? like if I want my 'Home' link to not open in a new window....
herroyalbleakness,
Welcome to my blog and thanks for subscribing.
Yes you can have exception links. Just insert target='_self' in each link.
Greenlava
With the theme I picked, I can't seem to edit my 'HOME' link so that it opens in the same window. It's a quick edit button and comes up with an error when I put target='self' to it :(
Oops...I didn't know you use a LinkList gadget for the navigation tabs. I went to see your code just now. Sorry but comment#32 is only applicable to normal list (like the code given in the beginning of this article).
If you like, you can replace the LinkList with normal list (of links), so that you can apply "target=" to individual link. It's difficult to explain here in comment section (with its limitation).
Email me if you're interested.
Thanks man was looking for this It works like a charm.
You're welcome Aditya.
This looks really simple, it's just that I cannot find this:
...data:link.target...
in my Expanded Widget Template.
I copy/pasted the whole code into a Word document (23 pages) and looked for "link" but it wasn't among it. Any ideas where i can find it?
http://sportsbabesandwags.blogspot.com/
alex,
Have you installed Link List gadget in your blog? If you haven't, you can't find it because the "data:link.target" code exists only in that widget.
I didn't install anything, so I guess I didn't install this. Should I? What's the added value and how can I add it?
The only thing I want is basically that when people click on a link in a post (for example a link to another news source), that the link opens in another window.
thanks for your help.
alex,
For a link in a post, add target="_blank" in your link HTML, as explained in the article.
It works perfectly, Greenlava, thanks for that. But I wanted to have this done automatically, every time I put a link in a post (so I don't have to add this "target="_blank" every time myself).
Your text under "Update: Blogger (blogspot) LinkList" in the artcile seemed (could have misuncerstood that) to solve this but like I said I don't find that part of the code.
alex,
To open all links in new windows automatically, use this code:
< base target="_blank"/ >
Place it right after the < head > tag in your template HTML.
Please read Setting a default target window in the article.
Werks perfect, Greenlava. Many thanks, exactly what I was looking for.
I've started a second blog about starting a blog where I write about my experiences. I'll make sure to dedicate a post on this issue and mention this blog:
http://thedummyblogs.blogspot.com/
I'm still catching a bit so may take a few more days.
You're welcome alex.
I added an RSS feed to my blog, which opens links in the same window. Adding target='_blank' to the line below doesn't work, nor does adding the base target= line to the header.
(a expr:href='data:feedUrl')(data:loadingMsg/)(/a)
Something about the form of this line doesn't seem to match your example. The actual url doesn't appear anywhere in the template either. Any idea what I can do? Thanks.
Hi gaia is forever,
I don't think you can change it to open in new window.
(a expr:href='data:feedUrl')(data:loadingMsg/)(/a) is for the link of Loading... message when the feed is loading.
The link to each feed item is not in our template code.
Using the base target is also of no use because Blogger override it with target="_sef" in each feed item.
Hello, I have two Link List in my blog but only the 1st one works and the 2nd cannot. Anyone have any solutions? Many thanks.
Joshua
Joshua Lim,
Welcome to Blogger Sentral.
If you have two LinkLists, then you will find two instances of href='data:link.target'.
You need to add in target="_blank" to both of them.
Hi, I've sorted my code to open links in a new window, but, I really want to make it open them in a tab in the same browser. Is there a way to specify this in the same manner as (base target="_blank" /)?
Thanks a bundle.
Daniel
Remember the Jungle?
It's explained in Setting a default target window, you replace "_blank" with a name, for example "myonlyothertab" :)
Hello! I am trying to follow your directions for making links in my sidebar gadget open in a new window.
Here, according to your instructions is what I'm adding replacing () for <> of course:
(li)(a expr:href='data:link.target'target='_blank')(data:link.name/)(/a)(/li)
Here is the error message I get:
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Element type "a" must be followed by either attribute specifications, ">" or "/>".
What am I doing wrong?
Rebecca,
You should provide a gap between 'data:link.target' and target='_blank', like this:
(li)(a expr:href='data:link.target' target='_blank')(data:link.name/)(/a)(/li)
Hey Greenlava!
It worked!
Thanks so much for being here! You are hereby bookmarked.
Hey Rebecca!
Thanks for the bookmark. Come back anytime...
Thanks greenlava for your helpful tips.
But I think you teach us only how to open a new tab not new window. Just click "file" button of your browser & you will see that new window & new tab is different things.
Now please tell me how do I open a link in a separate window?
Admin,
The code is just the same. Whether it opens in a new tab or in a new window, that depends on your browser setting.
Then sorry for bothering you.
Oh another problem, how do I use this method at HTML link?
Admin,
Read "2 methods of opening a link in a separate window (or tab)" in the article.
Thanks greenlave,
I am felling ashamed to say but i have another problem. It's not working on uploaded photo. How do I open a photo in tab?
Another problem, how do I separate (want to give some space from each to another) my previous photo? Do I delete them all & start uploading.
Admin'
Go to post editor HTML mode and look for the photo code. The trimmed down code should be something like this (replace () with <> ) :
(a onblur="blahblahblah" href="BIG_PICTURE_URL")(img src="INBLOG_PICTURE_URL"/)(/a).
Now to open the photo in a new window, do it like this:
(a onblur="blahblahblah" href="BIG_PICTURE_URL" target="_blank")(img src="INBLOG_PICTURE_URL"/)(/a)
To add space between photos, add margin:
(a onblur="blahblahblah" href="BIG_PICTURE_URL" target="_blank")(img src="INBLOG_PICTURE_URL" style="margin: 10px 5px 20px 10px" /)(/a)
The four pxs represent top, right, bottom and left margin respectively.
erm...can i ask is there any way to open a link into a new tab instead of a new window?
Hi noname_26,
Please read comments 55 and 56.
o...ok...thx greenlava... ^^
Hi Greenlava,
This was hard to get at first- As an artist, I am so visual. I kept looking for code that read, "anchor text" (even though you explained it below- I still did not get it).
At any rate, have made all links and images open in new window!
Thanks for the tips!
http://www.juliesusanne.blogspot.com/
Hi julie susanne,
Glad it worked out for you. Come back for more tips and hacks.
You are my hero. I have never done any of this before and I started my blog, stampndesign.blogspot.com, two days ago and its actually good thanks to you!!
You're welcome Lynn. For a list of all tips, click on the All Posts tab on the menu bar.
Hi, BloggrSentral, and thank you for great tutorial. I tried your reply no.9, (base target="_blank" /) and now all my "Read more HERE" - links opens in a new window, som there is probably some adjustment to awoid this? Thanks again, and hope for your reply.
Tor Christian Eilertsen,
Welcome back. Are you saying want the Read More to open in same window?
If that's the case go back to Blogger “read more” without the bug. In line 8 of the code there is a target='_blank', replace it with target='_self'.
This way even if you use base target="_blank", it will still open in same window.
Great instructions, but I've got a question. How do you get only gadget links to open in a new tab? Thnaks!
Amy,
For LinkList it's explained under "Update: Blogger (blogspot) LinkList" in the article.
Very clear instructions, thank you!
However, one little change: Should be "Edit HTML", not 'Edit Template'.
Thanks again!
Katie,
Got them fixed, all in 20+ posts! (since I use Windows Live Writer's text template).
A big THANK YOU for pointing that out.
I'm sorry I'm not getting it. I'm able to do it as individual links and in my widgits, but I'm not able to figure out how to automatically open links in posts with new windows. Please help if you can. Love your info BTW!
Lori at CouponomicStimulusPackage
Use base target, as explained in "Setting a default target window". To epen in new window, replace "OutboundWindow" with "_blank".
BTW I like your blog name :)
Hi, again, and thanks for the great answer (post 70)- it worked perfectly! I now have another small question for you: how do I get the "read more" to be placed to the left in the post as of now to the right. Thank you in advance. And your answers are great, so I will probably come back for more help. Ps: the blog is www.medkilaski.blogspot.com
Tor Christian Eilertsen,
Read the answer here
Legend! Thanks Heaps!
hey thanks for the info...i hav got a question for u...i want the posts to be opened in the same window when i click on them but the links in the post in a separate window...cud u plz tel me how to do it...
You're welcome Andrei Rotariu.
samcruise,
Under "2 methods of opening a link in a separate window (or tab)" use Method 1. You have to add "target=_blank" to each link.
OK, it's my turn to ask a stupid question. I have an "Amazon Search Box" widget on my blog (installed it from the Blogger "Add a Gadget" list), and I've opened up the widget template to try to add the code that would allow it to open in a new window, but there's no "a expr:href='..." line in the widget code. So I went up to the "(head)" and entered the "outbound" code in the hopes of opening all of the widgets in a new window, but that didn't work either. Is it because it is a Search Box that it's giving me so much trouble? Am I stuck with it as it is? http://dinnerfundraising.blogspot.com
@Mz_Idealist,
The search is overriding your setting. Nothing much you can do about it.
But I checked this particular Amazon search box by Daniyal Iqbal (it's the 7th on the list, when you entered "amazon"). This one does open in a new window by default.
It works! Thanks!
THANK YOU so much for this! I just tried the individual "new page" code for the blog I'm posting tomorrow. With my hubby (much more computer literate than me) looking over my shoulder to make sure I didn't do anything completely off the planet, we've successfully inserted the code! Can't wait for the page to go up tomorrow.
:)
Thanks, that was really helpful!
i am working on a friend's blog: http://meliezzawalkerphotography.blogspot.com
i used the blogger linklist widget to create the navbar. i want to be able to open a new window for ONLY the link titled "website", not the other links. i edited the html like you suggested (two instances) but it is not working.
2nd question - would this fix effect all the links in the navbar? if so, then wouldn't i need another fix so that only 1 link is affected?
thanks!
@Geoff Anciano
I'm afraid you can't single out a link from a LinkList. It's all or none.
Why don't you use non-LinkList navigation tabs. This method allows you do what you want, just by adding target="_blank" inside Website tab HTML code.
thanks, i'll look into the non-linklist navbar. great blog! alot of helpful info!
My skills are very rusty (and weren't so hot to begin with). I've been struggling for hours & tried many sources but this article was simple & helped me solve my problem in minutes. Thank you for speaking plainly for those of us who aren't IT folks. I'm linking the article on my blog & giving it props.
@PghGirl412
Thanks for linking
Awesome! Thank you so much for this easy to understand fix!
Geez, Greenlava, you must be sick of this target="_blank" thing by now, but sheepishly I'm still having trouble.
First, I tried the mentioned global fix directly under (head) which is: ( base target="_blank"/ ).
Well, THAT just gave me an error message. Dunno why.
What hasn't been mentioned much and seems the most obvious need for target blank is with the Photo Widget.
The darn thing gives you the option of specifying a link, but Google doesn't give a flying fig about your target. I looked at the code and it's different. The word target doesn't exist at all, so I don't know where to put blank. Code looks like this:
(b:if cond='data:link != ""')
(a expr:href='data:link')
(img expr:alt='data:title' expr:height='data:height' expr:id='data:widget.instanceId + "_img"' expr:src='data:sourceUrl' expr:width='data:width'/)
(/a)
Thanks for addressing this one more time :-(
@Anonymous
Put it inside the second line, like this:
(a expr:href='data:link' target='_blank')
Great just what I was looking for.
THANK-YOU!!! So easy to do, and now my readers aren't leaving my blog when I link up to something good. :)
@ET @ Titus2:3-5
You're welcome. I hope you're right about that :)
Hi. This is my first time doing anything like this and I'm having trouble. Trying to change the links gadget to open links in a new window. Changed the code to this:
(li)(a expr:href='data:link.target'target='_blank') (data:link.name/)(/a)(/li)
but keep getting error message:
Element type "a" must be followed by either attribute specifications, ">" or "/>"
What am I doing wrong?
Thanks!
@linda
You should add a space between 'data:link.target' and target='_blank'.
Thank you so much. Very Helpful.
THANK YOU so much! This was exactly what I've searched everywhere for! :D
I'm adding you to my favorite blog templates and tricks list. :)
Hi,
The instructions didn't 100% help me because I struggled to find the data:link.target in my document. They did put me on the right track and I have figured how to open in a new window. Ultimately I'd like them to open in a new tab, not window, but it's better than nothing. Thankyou. =)
@Kell
You have to tick the Expand Widget Templates checkbox for the internal LinkList code to show up.
Whether they open in a new tab or in a new window is dictated by your browser setting.
im try to do
< base target="_blank"/ >
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 content of elements must consist of well-formed character data or markup.
wht i do now ? mixsl.com
@Hit Man
Make sure there is no gap after the opening bracket < and before the closing bracket >.
I don't want EVERY link to open in a new window, just the ones I include in my blog POSTS. In other words, if you click on the title of my blog post, I want you to stay in same window. If I include a link to an outside site, I want it to open another window. I've been adding the code each time as needed for each outside site. Is there an easier way?
@Gayle
Only one way left -use Windows Live Writer to write your posts. You can set your in-post links to open in new window as default.
Thanks, Greenlava! A few people have recommended Win Live Writer and now you've given me a reason to try it.
it did not work in my blog.. http://www.agoodcatch.co.cc/
please help me
@a good catch
Which method did you try?
Hi!
Okay, so.. I followed my instincts to make my links open in a new tab (for the linklist widget's links) I added the target='_newTab' part to the widget code and when I'd click on the link at the webpage, I'd be redirected to a new window xD
Well I learned this can be just the way an old IE browser finds to open the link if he doesn't use tabs, though. But if I find anything on it, I'm telling you. :)
Hi,
I used the 'head'...'/head' on my blog and change the 'MyWindows' to '_blank' because the first only opens any of the links in one window so clicking one link will override the other. and using '_blank' worked!
thanks so much!
is there another way to specify which links to open in a new window? i tried the '_blank' on specific links but an error shows.
@haeki
What did the error say?
greenlava, i forgot the whole content but it was something like 'a' must not be open and should be followed by '/>'...i think adding the '_blank' made made the script long and separated (li)(a) from '= href...onwards'
@haeki
Make sure you close all (li and a) tags, like this:
[li][a href="YOUR URL" target"_blank"]Anchor text[/a][/li]
thanks! i'll do just that ^-^
WHERE IS THIS IN BLOGER HTML
head
head
I CANT FIND IT
@Jobsnownig.com
Go to Design > Edit HTML and use Ctrl+F (search function) to find the tag.
thank you for this....its working..
@kokila
My pleasure
Thanks a ton for this tip. Base tag worked wonders.
Hi, I just used your explanation for opening a link in a new window (the one in comment 9), and it works great, thank you! I actually tried the other method, so the items in my own archive won't open in a new tab, but this didn't work. Still, I'm happy with the current solution. But what I really wanted to know is what did you do that enables you to comment directly to comments in this blog (the green line and the numbers are also a nice edition). Is there an explanation on your blog on this? Thanks so much!!
@wintam
"what did you do that enables you to comment directly to comments" -I'm sorry, but I don't quite understand what do you mean by this.
You can highlight author comments too: How to highlight author comments in Blogger
To number comments refer to Numbering comments in Blogger
greenlava,
i already put ( base target="_blank" / ) below the (/head) part..
and i also put "urLinkUrl with http://highnessfiq.blogspot.com - its my blog url, because i dont know to replace it with what url..
I put that html code in between the others html code, i just randomly put there..
and i cant see where to find (and) and replace it with ..
i want all the link in my blog will open in a new tab, not window.. but it cant function..
can u help me?? thanks~
@HiGHNeSS FiQ
You should put the code after [head] not [/head]. It's near the top of your template code.
And the code is not (base target="_blank" /), it's [base target="_blank" /]
(replace [ and ] with < and > respectively. I can't post the correct code in the comment section)
Whether a link opens in a new tab or window (after you target blank it) depends on browser setting.
hi greenlava,
I have never learnth html or know what it is all about and I hv follow your blog for a few items in improving my blog and it has worked very well except this - opening link in new tab,
I have a number of links at my left side bar and tried method I and method II.
Method I :
one of my links at my side bar post became/have/shows this :(li)(a expr:href='data:link.target')(data:link.name/)(/a>(/li)
instead of the original url link name.
so I have to delete off that gadget.
Method II:
This keeps appearing after placing it after [head] whether
I tick expand widget gadget or not. Tried both and this appears:
We were unable to save 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 "".
Would appreciate your assistance on this.
from www.suciunggul.blogspot.com
@Bernard
1. That looks like a code for a LinkList. Did you replace a normal link code with this one? This code only belongs to a LinkList gadget, you can't use it elsewhere.
2. I guess you copied the whole thing (head and base tags). Should've copied only the base tag and paste it below [head].
Anyway, to avoid confusion I've removed [head] from the code.
thks for your concern,
1.Initially I add in -> _blank.., doesn't work.
2. wow, gee it's working now, you are my guru.
Thanks.
thanks greenlava~
its working now!!
;)
Hi Greenlava,
I got referred to this page from http://www.google.com/support/forum/p/blogger/thread?tid=553e40762dd50c70&hl=en
I hate that the links in my blog navigate away from my blog in that same window, instead of opening a new tab. The code you suggested is one I found in a few other help-articles and I've tried it but it doesn't seem to be working. I hate to make you repeat yourself, but I've even tried the suggestions you gave to other commenters and it's still not working =(
My blog is: www.kingdomemily.blogspot.com The particular link that I have been working on is on the "How did I get here" page, where it says Sabrina underneath the picture of the map. But, I would love if every link on my blog opened in a new tab. Can you help me please?
Thanks!
@emily
Go to Design > Edit HTML.
Go to the third line of your code. You should find [head].
Insert this code after that line:
[base target="_blank"]
(replace [ and ] with < and >)
Hi Greenlava,
Thanks for your help. I followed your suggestions, but when I went to save & apply the changes, this it the error message I got:
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 now?
@emily
Oops...the code should come with a slash, like this:
[base target="_blank" /]
Thank you!!! It worked!!!!
Hi Greenlava;
I want to open a new stand alone page with my navigation menu bar please help me like; namely: About me, Photos, contacts, Privacy
My Url http://engineerstandpoint.blogspot.com
@AMalobago
Go to Dashboard > New Post > Edit pages > New Page and create your pages. Then get the links, use them to replace the existing links in your tab.
Does that answer your question?
Thanks a lot!!
Dear friend i cant find this (<li><a expr:href='data:link.target'><data:link.name/></a></li>) but something like this (<li><a expr:href='data:blog.homepageUrl' title='Home'>Home</a></li>)
my blog cant open new tab pls solve this problem
@ஜிஎஸ்ஆர்
Try this:
[li][a expr:href='data:blog.homepageUrl' title='Home' target="_blank"]Home[/a][/li]
The problem I'm having is that my Twitter feeds, when I include links to them, will not open up in a new window - they simply open up in the same tiny Twitter gadget sidebar. I have tried a variety of fixes, none of which work. The site is http://sugarbowlacademy.blogspot.com. Thanks in advance for any solutions!
@Marmot Man
Where is this Twitter gadget? I can't find it.
I can't find anything resembling: expr:href='data:link.target'
I have expanded Widget Templates and it still is not there.
Suggestions?
-Stephanie
@Stephanie Hepburn
Are you sure what you have is a LinkList gadget?
I added the code to my header and all my links now open in a new tab/window. Thanks so much!
Yes man thanks for the tip.
Applied to my site and voila, you can witness it in my site:
http://www.kfgd63-sphinx.com
Wish you all the best.
KFGD63
Hi again Greenlava,
Somehow, some of the links on the sidebar of my blog open in new tabs now, and some still don't. Can you help me make sure they all do? I'm having trouble inserting the target=blank code into certain widgets, not sure where exactly it goes. My blog is www.kingdomemily.blogspot.com
Thanks!
Emily
@emily
If you want the majority of your links to open in new windows why not try II.Setting a default target window?
..and for the links you want to open in the same window, you apply "target=_self".
Ok, I'll try that. But, where exactly, within the rest of the html code, do I insert the code for "target=_self"?
@emily
Once you've added [base target="_blank"/] in the header of your template, all links will open in new tabs/windows.
You then add target="_self" to the links (inside LinkLists, tabs etc.) that you want to open in the same window, in the same manner you previously added target="_blank" to links you wanted to open in new windows.
Thanks for your response. I am still having some issues though.
I have realized that my bounce rate has gone way up because every time a person clicks on anything in my blog, it opens a new tab. I want to find some sort of middle ground, where all the components of the blog itself (previous posts, different pages, etc--everything with ....kingdomemily.blogspot.com in the address) all stick within the same tab (target="_self") BUT ALSO everything that is not a part of the blog would open in their own tabs.
If I put target=_blank at the very top of the html, after [head], it makes even the blog elements open in a new tab. So, I have removed that code from that place, and placed it specifically within the link-list html, like you advised.
But, for example, I have a picasaweb slideshow widget on my sidebar and I would like for it, when clicked, to open in a new tab. But, right now it opens in the same tab. Same goes for a few other items on the sidebar--I'm just not sure where exactly to put the target code within the html.
Does that make sense?
Thank you!
@emily
You can only add target attribute to HTML widgets (a LinkList is a HTML widget). Most third party widgets use scripts (non HTML) which prevent us from specifying the target window/tab.
@Greenlava,
Thanks for all your help!! I'll go with what works, and not worry about the rest.
:)
hi, yours are really great tips for blogging.
But i have a problem, i tried to change the code but the links open in the same windows except if you click home, about me pages etc. which is horrible.
i want the external links to open in new window like the flickr one and links in posts.
my blog is www.erziaulhaq.blogspot.com
thnx in advance.
Hi! Help! Trying to get my links to open in a new page (www.glamrosie.blogspot.com), expanded the widget templates but the list is so long to find the notes you mentioned above. Any ideas? Please talk in real simple pc terms for me!! Thank you in advance!
@Zia Ul Haq
There's now way to differentiate internal links from external links. You just have to specify each link one by one.
@Glamrosie
These steps will make all links open in new windows/tabs:
1. Find this code in your template (located afew line from the top):
[head]
2. Add this code right after that line:
[base target="_blank" /]
3. Save Template
Make sure you replace < with [ and > with ] when applying the code.
Hi, I tried! It wouldn't let me, came up with this message; Your template could not be parsed as it is not well-formed. Please make sure that all XML elements are closed properly.
XML error message: The element type "html" must be terminated by the matching end-tag "".
So I tried changing back to the <&> around 'Head' but doesn't work? Went into HTML & expanded widgets too?
@Glamrosie
I see you've put [base target="_blank" /] at the right place.
All you need to do now is replace < with [ and > with ]
(Blogger won't allow me to use < and > here in the comments)
This is awesome. Thank you so much, cant imagine how excited i am.
Greenlava,
Thank you so much!! I've found your blog just by chance. I've added the code under the head-tag. Now all links, posts, photos open in a new tab. That's brilliant!!!
Bookmarking your blog now and reading a bit more... :-)
Hi...I'm Newbie Please help
I have change my blog with added target="_blank"
But why I can't save my template?
Up's Sorry, I tried copy paste
And It's work
Thank you very much
Hello again! Am so sorry but am still struggling! It now looks like there is the letters 'quot' in there now, and my links still over ride my blog, plus now when I attach my blog as a link on my facebook page, all of the following show up under the web address;[base target="_blank" /] (function() { var a=window;function c(b){this.t={};this.tick=function(d,i,e){e=e?e:(new Date).getTime();this.t[d]=[e,i]};this.tick("start",null,b)}var f=new c;a.jstiming={Timer:c,load:f};try{var g=null;if(a.chrome&&a.chrome.csi)g=Math.floor(a.chrome.csi().pageT);if(g==nu..
@Glamrosie
[base target="_blank" /]
For the code to work, you need to replace [ with < and ] with >.
We can't enter the actual code here (in the comments) because it will give out an error.
Yipee - it worked, thank you so much, my blog won't be lost now when some one clicks on a link, thank you so much!
Only issue left now is due to something I've done, I still have that long list under my link when I post on my facebook page, as copied & pasted above - any ideas?
@Glamrosie
That long list is gone, now there's nothing under the post URL...good. But you could do better -read Facebook share showing wrong description –solved!, consider it your homework lol.
Your well clever - THANK YOU!!!
Now are you telling me I could do better with my fashion advice & writing or something largely 'techy' like that link suggests???
Jesus, I'm now struggling to post this comment as who i'm commenting as - never did before!!
@Glamrosie
I was referring to the techy stuff. Fashion is definitely out of my league :)
Phew!! mmmm, may leave the techy stuff for now might try later! Thanks so much for your help!
thank you this helped me a lot
awesome!
thanks... it FINALLY worked!
you're the best!
Thank you so much! It was a true "huzzah" moment!
Thank very much! It was very helpful!
hi greenlava, i've read and applied everything that you have posted here on BS and i can say it worked well on my blog.. but for this one.. i really need your help!!! i dont know what did i do wrong.. its just now that i've noticed that all that has link or that highlights on my blog open in a new tab..even the go to top button or tabs, everything.. how will i change it? is there something i did not follow?? i'm a newbie..
i just add this.. [ head ] [base target='_blank'/]
please.. help!☺
@mikiboto ♂ ( Mitch Dolar )
That's what it's supposed to do.
If you want to open only selected links in new tabs/windows, use target="_blank". However you have to add it to each individual link (that you want opened in new tab).
Hi Greenlava,
Your posts, tips & hints have been very useful. I am slowly learning the tricks & building my Blog. Thanks.
I couldn't find any way of clicking on Home from anywhere in the Blog and return to a fixed/static screen.
@Good Living
You mean "back to top" button?Adding a floating “back to top” button
I have to idea of what I'm doing. Where am I supposed to paste the code?
Yourlinkurl = the page I want people to visit
What is windowname???
@Armando Roque
Where to use the code.
1. For in-post links go to edit the post in Post editor's HTML mode.
2. For LinkList go to Design > Edit HTML.
3. For HTML/Javascript widget go to Page Elements > Edit.
If you want to open the link in a new window on each click, just replace "windowname" with "_blank".
Hey Greenlava--
I'm having some inconsistencies with opening links in new windows in today's post to our blog. I've tried moving the target="windowname" code in a couple of different places in the HTML edit field without any luck. Can you help out?
Thanks.
Hey Greenlava--
Never mind. I went back over it and got it working.
Great blog--it's been very, very helpful in getting our blog working the way we want! Thanks!
Dear Greenlava,
You are awesome. I just followed your directions and solved the issue of not being able to have links pop up in a separate window.
Thank you so much.
Hi, Thanks for great tips. I m trying to comment on the blogs. It was not allowing me to post blog comment when I m using anchor text back link. It was saying Your HTML cannot be accepted: Attribute "TARGET" is not allowed in tag: A
Can you suggest me to over come the problem.
Getting approved comment is another part.
First of all I cant able to comment with my link. But some others are commented with there anchor text back links.
How to they are doing this.
@datastage
You have to remove the target attribute.
Example,
This link (with target) is not allowed:
[a href="http://www.bloggersentral.com/2010/07/install-floating-social-media-buttons.html" target="_blank"]Adding floating social media sharing buttons to Blogger[/a]
but this one without target is allowed:
[a href="http://www.bloggersentral.com/2010/07/install-floating-social-media-buttons.html"]Adding floating social media sharing buttons to Blogger[/a]
and here's the result:
Adding floating social media sharing buttons to Blogger
Hi,
Thanks for helping out. I have reviewed this in my Blog.
You can view it here > http://bit.ly/ebMjFC
@Muhammad Gohar Shafique
Thanks for linking it back to this post :)
OMG thank you so much! You made it easy :)
Your tip of adding (base target="_blank" /) worked for my blog! Thanks for the tip1 I'm slowly getting educated on this.
thanks that really helped me a lot!!!
Thanks man I tried your stuff and it actually worked....Thank once again
you can also use a base code like this
put this code right after
*delete g in both base & head
Is there an automatic way to set this for all links in posts only? Not every link on your blog. Thanks for any help!
@Cap Creations
No there isn't any auto way of doing that. But I have a suggestion for you, why don't you use Windows Live Writer to write your posts. WLW has a menu to cater for that.
Thank you for continually teaching me. Knowledge is power.
real useful, and works perfectly and easily, I've used your suggestion to name the window instead of leaving it blank, so it doesn't create too many windows/tabs, thank you :-)
Thank you, thank you, thank you, Greenlava, for making your generous, gracious, patient and polite assistance so accessible and available to all!
Thanks a ton mate !
I was so happy to find your clear, easy to follow instructions regarding this...thank you so much! Worked perfectly :)
Thank you, couldn't be simpler for LinkList. Just beware that if you have more than one LinkList you will need to add the target="_blank"to both sets of code.
I am so glad I found this today! I have looked everywhere for how to open a new window from my link list! This worked and was so easy! Thank you!
I was searching for this information. Thanx for this. very useful article.
Comments on this post are closed.