Thursday, September 1, 2011

How To Make Links Open In A New Widow On Blogger



Just a few days ago, I was seriously considering going into crisis mood.  You can read all about [here].

At the end of the article, I mention that WordPress does have one big advantage over Blogger, and that is the ability to open links in a new window.  Well, I just found out how to do it on Blogger, as well.

Grace, of [Dragon’s Alley] fame and fortune came to my rescue at first.  For she found how to do it with individual links, which you can read about [here], and after being absolutely overjoyed over this, I found a way to make ALL links open in a new window automatically.

Now, I am somewhat reluctant to give this person credit.  For when I asked him for some help with this several months ago, he ignored me, and since he had already published an article about it, all he had to do was direct me to it.

Anyway, whether a jerk or not, credit should be given when due, and you read what he wrote [here].  Ironically, if you click on the links in his article, they do not open in a new window, but the code he provides works on all of my sites now.  In all fairness, Google has been making some drastic changes to Blogger, and it may very well be that he just needs to enter it again.

In order to make it a little easier on you (hopefully), a step-by-step guide is below.  Please, make sure and download a copy of your current template to your hard drive, just in case something goes wrong.  It shouldn’t, but…

Step 1: Go to your Blogger Dashboard.

Step 2: On Blogger-In-Draft, you will see an image that looks like a couple of pieces of paper, and just to the right of it, you will see an arrow for a drop-down menu.  Click on “Template” on the drop-down menu.

Step 3: Click on “Edit HTML” under “Live on Blog.” After doing so, you should see something like the following in the box under “Template > Edit HTML.”
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
  <head>

Step 4:  What you are seeing is the first few lines of code to your template, and under <head>, paste (or manually type in) <base target='_blank' />  After doing so, your code should look like the following:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html expr:dir='data:blog.languageDirection' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
  <head>
  <base target='_blank'/>
Note: I don’t know if it is really necessary, but I added a couple of spaces to the front of <base target… so that it would line up with <head>.

Step 5: Click on “Save Template” at the bottom and to the right of the box.

Step 6: After the template has updated, which should only take a few seconds, click on “Close” to the left of “Save Template.”

Step 7: Open a page on your site, and marvel at what a technical genius you are after seeing your links open in a new window!  (That is, until Google decides to make some more “improvements,” of course.)

Please Also Visit:
and

13 comments:

Grace said...

Now see that is interesting because I use the "a href" with "target=" code only when I need it since not all my posts use links. In which case the code is inserted in the "Edit HTML" view NOT the "Compose" view.

I applaud your ingenuity in finding this template changing code and figuring out where it goes in your base template. Personally I don't mess around with my base template. As I said in my post, I am not good with code. I use the "a href" code only when I need it and it is easy to do so I think I'll stick with that.

Kudos to you for figuring out this much more complicated way to do things! Sincerely - kudos!

FishHawk said...

Thanks for stopping by, my dear Grace!!! Be assured that I had a lot of help, which you certainly contributed to. If what you already do works, there is no need to mess with anything else.

John Myste said...

Thanks, Fish. I find this feature abominable. It is a form of spam.

Respectfully,
J

FishHawk said...

Thanks for stopping by again, my dear John!!! Um, you've got me confused on this one. Are you talking what I wrote, or being able to make links open in a new window, which saves readers from having to go back and forth between the original article and the links in the same window?

Lavender Darwin said...

Nifty! Although to me, my posts are so inane, if someone clicks a link and spring somewhere else on the same tab, they are probably better off.

As for the remark about not getting a response from the guy and whether he was being "a jerk or not", always give the benefit of the doubt to over-vigilant spam filters gobbling emails...

FishHawk said...

Thanks for stopping by again, my dear Lavender!!! Oh, my comment was posted, but he never bothered to respond. I even went back to check several times over a period of several days just in case I wasn't getting the email notification. Nonetheless, your point is well-taken.

Chatty Crone said...

Okay I had to make a copy of this - the old brain wouldn't remember - thank you!

FishHawk said...

Thanks for stopping by again, my dear Sandie!!! I hope you don't have any trouble.

John Myste said...

Thanks for stopping by again, my dear John!!! Um, you've got me confused on this one. Are you talking what I wrote, or being able to make links open in a new window, which saves readers from having to go back and forth between the original article and the links in the same window?

I like to have one window per blog. I just use the backspace key to navigate.

FishHawk said...

Thanks for getting back to me, my dear John. It sounds like you may have some hillbilly in you.

John Myste said...

LOL. Is that what that means?

John Myste said...

Get him out!

FishHawk said...

Well, I can't speak for all of them, but as for myself and most of those I have known over the years, we have a tendency to resist fixing something even after it is clearly broken.