Monday, May 9, 2016

How to make your links in blogger Gadgets to open in a New Window

Here's another thing I've added to this blog.

Since I have some external link in this blog using the Link Gadget, clicking on the link kept opening on the same page. Meaning it moves away from my blog. Now this is very annoying mind you, since I don't intended to leave my blog just yet.

Now the main problem here is that there is no option in the Link Gadget to select for the links to open in a new window. That should've been a default option for us to select apparently, but guess someone forgotten to either add it in, or is too lazy to bother ...

No matter, there's always a way around it.

So yeah, I'm all googling for the answer and yeap, there's a lot of guide on the internet to guide you.

It's so simple in fact, it only took less than a line of code to make the Link Gadget to comply to my demands ... "open the dang link in another window and mind your own business".

Same as always, goto your template and edit HTML.



Once there, you'll see a bunch of codes.
Don't worry, they won't bite.

Click on ... Jump to Widgets, and select your relevant widgets, like PageList1 or LinkList1.




























For me, I wanted the links in my LinkList1 to open in a New Window, so that's what I picked.

Once you've clicked on the LinkList1 from the drop down, it'll jump you to the relevant code for that widget.

Look for the id='LinkList1' and you'll know you're there.

Expand the code by clicking on the triangular arrow on the left near the line numbers to show all the codes under it.









Now look for a similar code as highlight below:
<a expr:href='data:link.target'>









That is the code that we are going to amend here.

PS: Do note that if you don't see that line of code or similar, in some cases, you probably need to expand more codes as before.

Make the little amendments as so:

From
<a expr:href='data:link.target'>
To
<a expr:href='data:link.target' target='_blank'> 

Add the lines bolded in red above, save your work, and test it out :)

Cheers,

No comments:

Post a Comment

Contact Form

Name

Email *

Message *