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).

  1. 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.
  2. 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:

  1. Go to Template > Edit HTML.
  2. 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.
  3. Find the following code using the search box. This code is a part of LinkList gadget's code:
    <li><a expr:href=''><></a></li>
  4. Finally, insert target="_blank" inside the a tag, like this:

    <li><a expr:href='' target="_blank"><></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>
<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>
<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


213 comments to "Make A Link Opens In A New Window or Tab"

«Oldest ‹Older 1 – 200 of 213 Newer› Newest»
Antimorfeu April 30, 2009 at 3:03 PM    

With what are you replaceing ”yourlinkurl”?
I'm a newbie. Thanks

Greenlava April 30, 2009 at 5:24 PM    

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 "". In this example this is yourlinkurl, it is the address of your Blogger profile. And "Antimorfeu" is the anchor.

Antimorfeu May 1, 2009 at 1:17 PM    

Greenlava, thank you very much. I'll give it a try

Vicky May 18, 2009 at 5:15 AM    

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.

Greenlava May 18, 2009 at 9:35 AM    

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='')(
You want to insert the target _blank tag here, making it look like this:
(li)(a expr:href='' target='_blank')(

That's it!

Vicky May 18, 2009 at 2:11 PM    

Wow! That was easy. Thanks so much. I'm sure I'll have more questions later.

Thanks again!

Simpleman95 May 19, 2009 at 1:05 AM    

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?

Greenlava May 19, 2009 at 1:10 AM    

Don't mention it. Come back anytime..

Greenlava May 19, 2009 at 2:08 AM    

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:
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

Simpleman95 May 19, 2009 at 2:27 AM    

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.

Greenlava May 19, 2009 at 8:45 AM    

You should put the code inside "<" and ">"

Simpleman95 May 19, 2009 at 12:01 PM    

Now it worked.
Thank you so much for your help!
I really appreciate it.

Aisling Ní Acamé June 8, 2009 at 11:50 PM    

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:

Thanks for your great blog.

Greenlava June 9, 2009 at 2:16 AM    

Hi Aisling Ní Acamé,
What is the link you're working with? Is it the
First of all the link should be

To open it in a new window, use this:

(a href="" target="_blank")

Please replace "(" and ")" with "<" and ">" respectively.
Thanks and welcome to my blog.

Aisling Ní Acame June 11, 2009 at 9:46 PM    

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:


Greenlava June 12, 2009 at 1:20 AM    

@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.

laja June 13, 2009 at 5:39 PM    

Thank you, Greenlava!

The base target attribute works great.

Greenlava June 13, 2009 at 6:03 PM    

You're welcome laja...

Sheelagh June 23, 2009 at 1:56 AM    

Hi Greenlava, just wanted to say thanks. I have a new blog - -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.

Greenlava June 23, 2009 at 10:41 AM    

My pleasure Sheelagh

Sheelagh June 25, 2009 at 12:49 AM    

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

Greenlava June 25, 2009 at 1:15 AM    

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?

Sheelagh June 25, 2009 at 4:47 PM    

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

Greenlava June 25, 2009 at 7:04 PM    

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 :(

Sheelagh June 25, 2009 at 8:31 PM    

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?

Greenlava June 25, 2009 at 10:07 PM    

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.

Barry D. Moore July 1, 2009 at 4:16 AM    

you are the daddy, great tips man

Greenlava July 1, 2009 at 9:41 AM    

Thank you and don't forget to come back.

book4fun July 15, 2009 at 11:28 PM    

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)
Here my blog is:

Greenlava July 16, 2009 at 1:14 AM    

You're welcome.
The same method applicable to external links too.

herroyalbleakness August 11, 2009 at 6:11 AM    

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....

Greenlava August 11, 2009 at 9:51 AM    

Welcome to my blog and thanks for subscribing.
Yes you can have exception links. Just insert target='_self' in each link.

herroyalbleakness August 11, 2009 at 4:22 PM    


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 :(

Greenlava August 11, 2009 at 7:41 PM    

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.

Aditya September 4, 2009 at 2:02 AM    

Thanks man was looking for this It works like a charm.

Greenlava September 4, 2009 at 8:18 PM    

You're welcome Aditya.

alex September 9, 2009 at 3:11 AM    

This looks really simple, it's just that I cannot find this:

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?

Greenlava September 9, 2009 at 10:50 AM    

Have you installed Link List gadget in your blog? If you haven't, you can't find it because the "" code exists only in that widget.

alex September 9, 2009 at 7:09 PM    

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.

Greenlava September 10, 2009 at 2:59 AM    

For a link in a post, add target="_blank" in your link HTML, as explained in the article.

alex September 10, 2009 at 9:26 PM    

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.

Greenlava September 11, 2009 at 3:30 AM    

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.

alex September 11, 2009 at 5:17 PM    

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:

I'm still catching a bit so may take a few more days.

Greenlava September 13, 2009 at 9:04 AM    

You're welcome alex.

gaia is forever September 23, 2009 at 12:36 PM    

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.

Greenlava September 23, 2009 at 4:55 PM    

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.

Joshua Lim September 25, 2009 at 10:36 AM    

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.


Greenlava September 26, 2009 at 12:55 AM    

Joshua Lim,
Welcome to Blogger Sentral.
If you have two LinkLists, then you will find two instances of href=''.
You need to add in target="_blank" to both of them.

Remember the Jungle? October 2, 2009 at 8:29 AM    

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.


Greenlava October 2, 2009 at 11:29 AM    

Remember the Jungle?
It's explained in Setting a default target window, you replace "_blank" with a name, for example "myonlyothertab" :)

Rebecca October 6, 2009 at 10:58 PM    

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=''target='_blank')(

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?

Greenlava October 7, 2009 at 12:28 AM    

You should provide a gap between '' and target='_blank', like this:
(li)(a expr:href='' target='_blank')(

Rebecca October 7, 2009 at 6:55 AM    

Hey Greenlava!

It worked!

Thanks so much for being here! You are hereby bookmarked.

Greenlava October 7, 2009 at 12:42 PM    

Hey Rebecca!
Thanks for the bookmark. Come back anytime...

Admin October 8, 2009 at 12:55 PM    

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?

Greenlava October 8, 2009 at 1:40 PM    

The code is just the same. Whether it opens in a new tab or in a new window, that depends on your browser setting.

Admin October 9, 2009 at 1:14 PM    

Then sorry for bothering you.

Admin October 9, 2009 at 1:35 PM    

Oh another problem, how do I use this method at HTML link?

Greenlava October 9, 2009 at 3:14 PM    

Read "2 methods of opening a link in a separate window (or tab)" in the article.

Admin October 10, 2009 at 8:27 PM    

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.

Greenlava October 12, 2009 at 2:48 PM    

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.

noname_26 October 15, 2009 at 10:49 PM    

erm...can i ask is there any way to open a link into a new tab instead of a new window?

Greenlava October 16, 2009 at 12:10 AM    

Hi noname_26,
Please read comments 55 and 56.

noname_26 October 16, 2009 at 1:17 PM    

o...ok...thx greenlava... ^^

julie susanne October 18, 2009 at 12:22 PM    

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!

Greenlava October 18, 2009 at 10:23 PM    

Hi julie susanne,
Glad it worked out for you. Come back for more tips and hacks.

Lynn October 23, 2009 at 7:37 AM    

You are my hero. I have never done any of this before and I started my blog,, two days ago and its actually good thanks to you!!

Greenlava October 23, 2009 at 11:25 PM    

You're welcome Lynn. For a list of all tips, click on the All Posts tab on the menu bar.

Tor Christian Eilertsen October 29, 2009 at 4:42 PM    

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.

Greenlava October 29, 2009 at 6:52 PM    

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.

Amy November 7, 2009 at 10:43 PM    

Great instructions, but I've got a question. How do you get only gadget links to open in a new tab? Thnaks!

Greenlava November 8, 2009 at 12:52 AM    

For LinkList it's explained under "Update: Blogger (blogspot) LinkList" in the article.

Katie November 10, 2009 at 9:43 AM    

Very clear instructions, thank you!

However, one little change: Should be "Edit HTML", not 'Edit Template'.

Thanks again!

Greenlava November 10, 2009 at 11:59 AM    

Got them fixed, all in 20+ posts! (since I use Windows Live Writer's text template).
A big THANK YOU for pointing that out.

Lori at CouponomicStimulusPackage November 24, 2009 at 11:55 PM    

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!

Greenlava November 25, 2009 at 12:55 PM    

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 :)

Tor Christian Eilertsen November 28, 2009 at 6:01 AM    

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

Greenlava November 29, 2009 at 1:44 AM    

Tor Christian Eilertsen,
Read the answer here

Andrei Rotariu December 9, 2009 at 6:06 PM    

Legend! Thanks Heaps!

samcruise December 24, 2009 at 1:53 AM    

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...

Greenlava December 24, 2009 at 8:30 PM    

You're welcome Andrei Rotariu.

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.

Mz_Idealist January 12, 2010 at 5:26 AM    

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?

Greenlava January 12, 2010 at 9:46 PM    

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.

Mz_Idealist January 13, 2010 at 7:42 AM    

It works! Thanks!

Sharon Archer January 13, 2010 at 6:56 PM    

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.

zarazek January 16, 2010 at 7:41 PM    

Thanks, that was really helpful!

Geoff Anciano January 23, 2010 at 4:44 AM    

i am working on a friend's blog:

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?


Greenlava January 23, 2010 at 10:10 PM    

@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.

Geoff Anciano January 26, 2010 at 6:36 AM    

thanks, i'll look into the non-linklist navbar. great blog! alot of helpful info!

PghGirl412 February 1, 2010 at 5:53 AM    

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.

Greenlava February 2, 2010 at 9:29 PM    

Thanks for linking

Cindy February 3, 2010 at 11:05 AM    

Awesome! Thank you so much for this easy to understand fix!

Anonymous,  February 10, 2010 at 6:23 AM    

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'/)

Thanks for addressing this one more time :-(

Greenlava February 10, 2010 at 3:47 PM    

Put it inside the second line, like this:
(a expr:href='data:link' target='_blank')

Jim February 11, 2010 at 12:28 AM    

Great just what I was looking for.

ET @ Titus2:3-5 February 23, 2010 at 4:58 AM    

THANK-YOU!!! So easy to do, and now my readers aren't leaving my blog when I link up to something good. :)

Greenlava February 23, 2010 at 3:03 PM    

@ET @ Titus2:3-5
You're welcome. I hope you're right about that :)

linda February 26, 2010 at 7:30 AM    

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=''target='_blank') (

but keep getting error message:
Element type "a" must be followed by either attribute specifications, ">" or "/>"

What am I doing wrong?


Greenlava February 26, 2010 at 1:03 PM    

You should add a space between '' and target='_blank'.

All Your Basecast March 11, 2010 at 4:57 PM    

Thank you so much. Very Helpful.

Darlene Servolini April 25, 2010 at 1:31 PM    

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. :)

Kell July 14, 2010 at 10:09 AM    

The instructions didn't 100% help me because I struggled to find the 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. =)

Greenlava July 14, 2010 at 11:12 AM    

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.

Hit Man July 15, 2010 at 12:30 AM    

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 ?

Greenlava July 15, 2010 at 5:06 PM    

@Hit Man
Make sure there is no gap after the opening bracket < and before the closing bracket >.

Gayle August 5, 2010 at 2:31 AM    

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?

Greenlava August 5, 2010 at 8:28 AM    

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.

Gayle August 5, 2010 at 9:33 AM    

Thanks, Greenlava! A few people have recommended Win Live Writer and now you've given me a reason to try it.

a good catch August 18, 2010 at 11:25 AM    

it did not work in my blog..
please help me

Greenlava August 18, 2010 at 3:55 PM    

@a good catch
Which method did you try?

Grapiglia Arquitetura August 28, 2010 at 2:29 AM    

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. :)

haeki September 1, 2010 at 1:14 AM    

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.

Greenlava September 1, 2010 at 3:00 AM    

What did the error say?

haeki September 2, 2010 at 12:17 AM    

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'

Greenlava September 2, 2010 at 1:17 AM    

Make sure you close all (li and a) tags, like this:
[li][a href="YOUR URL" target"_blank"]Anchor text[/a][/li]

haeki September 2, 2010 at 9:25 AM    

thanks! i'll do just that ^-^ September 14, 2010 at 5:31 PM    



Greenlava September 14, 2010 at 11:57 PM
Go to Design > Edit HTML and use Ctrl+F (search function) to find the tag.

kokila September 17, 2010 at 7:28 PM    

thank you for this....its working..

Greenlava September 18, 2010 at 7:05 AM    

My pleasure

CreativeMama September 21, 2010 at 2:08 AM    

Thanks a ton for this tip. Base tag worked wonders.

wintam September 28, 2010 at 5:25 AM    

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!!

Greenlava September 28, 2010 at 8:42 PM    

"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

HiGHNeSS FiQ September 29, 2010 at 7:17 AM    

i already put ( base target="_blank" / ) below the (/head) part..
and i also put "urLinkUrl with - 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~

Greenlava September 29, 2010 at 10:39 PM    

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.

Bernard October 7, 2010 at 6:38 PM    

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='')(>(/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.


Greenlava October 8, 2010 at 8:00 AM    

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.

Shaefiq Bernard October 8, 2010 at 10:01 AM    

thks for your concern,
1.Initially I add in -> _blank.., doesn't work.
2. wow, gee it's working now, you are my guru.

HiGHNeSS FiQ October 8, 2010 at 10:09 AM    

thanks greenlava~
its working now!!

emily October 9, 2010 at 6:59 AM    

Hi Greenlava,

I got referred to this page from
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: 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?


Greenlava October 9, 2010 at 12:50 PM    

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 >)

emily October 10, 2010 at 6:43 AM    

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?

Greenlava October 10, 2010 at 10:24 AM    

Oops...the code should come with a slash, like this:
[base target="_blank" /]

emily October 29, 2010 at 11:43 PM    

Thank you!!! It worked!!!!

AMalobago October 30, 2010 at 12:36 PM    

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

Greenlava November 1, 2010 at 8:44 PM    

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?

Soheila November 3, 2010 at 1:45 AM    

Thanks a lot!!

ஜிஎஸ்ஆர் November 11, 2010 at 1:04 PM    

Dear friend i cant find this (<li><a expr:href=''><></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

Greenlava November 12, 2010 at 2:02 AM    

Try this:
[li][a expr:href='data:blog.homepageUrl' title='Home' target="_blank"]Home[/a][/li]

Marmot Man November 13, 2010 at 2:53 AM    

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 Thanks in advance for any solutions!

Greenlava November 13, 2010 at 7:39 PM    

@Marmot Man
Where is this Twitter gadget? I can't find it.

Stephanie Hepburn November 14, 2010 at 11:41 AM    

I can't find anything resembling: expr:href=''
I have expanded Widget Templates and it still is not there.



Greenlava November 14, 2010 at 8:11 PM    

@Stephanie Hepburn
Are you sure what you have is a LinkList gadget?

Sara November 20, 2010 at 11:02 PM    

I added the code to my header and all my links now open in a new tab/window. Thanks so much!

KFGD63 November 24, 2010 at 11:39 AM    

Yes man thanks for the tip.
Applied to my site and voila, you can witness it in my site:
Wish you all the best.

emily November 30, 2010 at 12:45 AM    

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


Greenlava November 30, 2010 at 5:40 PM    

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".

emily December 3, 2010 at 12:45 AM    

Ok, I'll try that. But, where exactly, within the rest of the html code, do I insert the code for "target=_self"?

Greenlava December 3, 2010 at 11:45 AM    

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.

emily December 7, 2010 at 7:48 AM    

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 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!

Greenlava December 8, 2010 at 10:41 PM    

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.

emily December 10, 2010 at 5:05 AM    


Thanks for all your help!! I'll go with what works, and not worry about the rest.


Zia Ul Haq December 12, 2010 at 3:24 PM    

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

thnx in advance.

Glamrosie December 19, 2010 at 10:38 PM    

Hi! Help! Trying to get my links to open in a new page (, 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!

Greenlava December 20, 2010 at 2:34 PM    

@Zia Ul Haq
There's now way to differentiate internal links from external links. You just have to specify each link one by one.

These steps will make all links open in new windows/tabs:
1. Find this code in your template (located afew line from the top):
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.

Glamrosie December 23, 2010 at 5:54 AM    

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?

Greenlava December 24, 2010 at 10:19 PM    

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)

Baoshancampus January 8, 2011 at 12:39 AM    

This is awesome. Thank you so much, cant imagine how excited i am.

Molly January 20, 2011 at 6:11 PM    

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... :-)

WHAT PEOPLE NEEDS January 28, 2011 at 5:23 PM    

Hi...I'm Newbie Please help
I have change my blog with added target="_blank"
But why I can't save my template?

WHAT PEOPLE NEEDS January 28, 2011 at 5:29 PM    

Up's Sorry, I tried copy paste

And It's work

Thank you very much

Glamrosie January 30, 2011 at 4:04 AM    

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(;if(g==nu..

Greenlava January 30, 2011 at 8:22 AM    

[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.

Glamrosie January 31, 2011 at 2:14 AM    

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?

Greenlava January 31, 2011 at 10:32 AM    

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.

Glamrosie February 1, 2011 at 2:56 AM    

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!!

Greenlava February 1, 2011 at 3:37 PM    

I was referring to the techy stuff. Fashion is definitely out of my league :)

Anonymous,  February 2, 2011 at 1:28 AM    

Phew!! mmmm, may leave the techy stuff for now might try later! Thanks so much for your help!

Michele February 2, 2011 at 5:23 AM    

thank you this helped me a lot

melimba February 3, 2011 at 5:43 AM    

thanks... it FINALLY worked!
you're the best!

argentwolfwing February 5, 2011 at 12:00 PM    

Thank you so much! It was a true "huzzah" moment!

The admins February 19, 2011 at 7:50 AM    

Thank very much! It was very helpful!

mikiboto ♂ ( Mitch Dolar ) March 6, 2011 at 4:46 AM    

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!☺

Greenlava March 7, 2011 at 10:54 AM    

@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).

Good Living March 30, 2011 at 12:42 PM    

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.

Greenlava March 30, 2011 at 7:17 PM    

@Good Living
You mean "back to top" button?Adding a floating “back to top” button

Armando Roque April 1, 2011 at 7:57 AM    

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???

Greenlava April 1, 2011 at 10:14 AM    

@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".

Cook's Direct April 19, 2011 at 11:46 PM    

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?


Cook's Direct April 19, 2011 at 11:57 PM    

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!

Indian Sports April 23, 2011 at 10:44 AM    

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.

datastage April 24, 2011 at 11:43 AM    

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.

Greenlava April 24, 2011 at 1:38 PM    

You have to remove the target attribute.
This link (with target) is not allowed:
[a href="" target="_blank"]Adding floating social media sharing buttons to Blogger[/a]

but this one without target is allowed:
[a href=""]Adding floating social media sharing buttons to Blogger[/a]
and here's the result:
Adding floating social media sharing buttons to Blogger

Muhammad Gohar Shafique April 25, 2011 at 5:23 AM    


Thanks for helping out. I have reviewed this in my Blog.
You can view it here >

Greenlava April 25, 2011 at 9:50 AM    

@Muhammad Gohar Shafique
Thanks for linking it back to this post :)

Lorrinda May 9, 2011 at 12:59 AM    

OMG thank you so much! You made it easy :)

Patty May 24, 2011 at 4:20 AM    

Your tip of adding (base target="_blank" /) worked for my blog! Thanks for the tip1 I'm slowly getting educated on this.

lydz81 May 25, 2011 at 4:55 PM    

thanks that really helped me a lot!!!

Hanumant June 14, 2011 at 11:43 PM    

Thanks man I tried your stuff and it actually worked....Thank once again

Daily Latest Results June 16, 2011 at 3:25 PM    

you can also use a base code like this

put this code right after

*delete g in both base & head

Cap Creations July 3, 2011 at 1:56 PM    

Is there an automatic way to set this for all links in posts only? Not every link on your blog. Thanks for any help!

Greenlava July 4, 2011 at 4:12 PM    

@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.

A World Without Money. July 19, 2011 at 10:07 PM    

Thank you for continually teaching me. Knowledge is power.

Esteryn September 1, 2011 at 4:44 PM    

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 :-)

AverageJane123 September 3, 2011 at 4:43 AM    

Thank you, thank you, thank you, Greenlava, for making your generous, gracious, patient and polite assistance so accessible and available to all!

Tifosi Guy September 18, 2011 at 8:00 AM    

Thanks a ton mate !

Tezzie September 27, 2011 at 9:04 PM    

I was so happy to find your clear, easy to follow instructions regarding this...thank you so much! Worked perfectly :)

Jamie November 5, 2011 at 6:59 PM    

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.

"T" January 26, 2012 at 6:48 AM    

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!

adfly tricks January 26, 2012 at 7:42 PM    

I was searching for this information. Thanx for this. very useful article.

«Oldest ‹Older 1 – 200 of 213 Newer› Newest»
Click to go to top Click to comment