PDA

View Full Version : target="_blank" to rel="external"


Jeremy82
2012-09-13, 07:29 AM
I just realized that target="_blank" is a really archaistic thing and what's more - it is not valid.

Attribute rel="external" is the solution but I don't want to have a mess in my code. For example I noticed that Greenie uses it too in his new link lists, but I have no idea, where is this parameter defined (as it is not visible in the code).

Greenguy
2012-09-13, 08:22 AM
target="_blank" opens a link in a new window/tab

rel="external" lets the SE spiders know it's an external link

Also,
rel="nofollow" tells the SE spider to ignore the link (used for sponsor links as well as pages you do not want spidered, like webmaster pages)

Greenguy
2012-09-13, 08:25 AM
And the "target" tag is still valid in HTML5:
http://www.w3schools.com/html5/att_a_target.asp

Jeremy82
2012-09-13, 05:08 PM
rel="external" lets the SE spiders know it's an external linkHow did you do that your external links are openning in a new window without any "target" tags?

Thanks for the definition BTW. ;)

Greenguy
2012-09-13, 05:19 PM
|bow|cd34 wrote up this handy bit of code to open all external links in a new window/tab

<script type="text/javascript">
<!--
var localdomain='link-o-rama.com';
var hrefs = document.getElementsByTagName("a");
for (var i=0, max=hrefs.length; i<max; i++) {
if (hrefs[i].href.indexOf(localdomain) == -1) {
hrefs[i].target='_blank';
}
};
// -->
</script>

Just change link-o-rama.com to your domain & put this above the </body> tag :)

Jeremy82
2012-09-13, 05:25 PM
Excellent, thanks. I'll use it in meta tag like: <script type="text/javascript" src="file_path/external.js"></script>

|bow|cd34 wrote up this handy bit of codeIsn't it owner of colo-cation?

Cleo
2012-09-13, 05:47 PM
Isn't it owner of colo-cation?
CD isn't an it but he is the owner of colo-cation.

Jeremy82
2012-09-13, 06:26 PM
CD isn't an it but he is the owner of colo-cation.Sorry, this construction comes from my native language. I'm seriously considering moving my stuff out there (the most tempting thing for me is unlimited amount of IP's).

Cleo
2012-09-13, 06:36 PM
colo-cation is where all my stuff is hosted as is this board.

Best hosting I've ever had and Chris (cd34) is a fantastic tech.

Jeremy82
2012-09-13, 06:44 PM
I've decided that I will start the move in early 2013.

Greenguy
2012-09-14, 09:15 AM
Why wait - move NOW!

Jeremy82
2012-09-14, 09:30 AM
Why wait - move NOW!No problem, but first I need to find out if they offer a different dedicated IP for each domain (within their "virtual hosting").

pc
2012-09-14, 01:30 PM
All the thumbs for his servers.

Maj. Stress
2012-09-15, 01:46 PM
|bow|cd34 wrote up this handy bit of code to open all external links in a new window/tab

<script type="text/javascript">
<!--
var localdomain='link-o-rama.com';
var hrefs = document.getElementsByTagName("a");
for (var i=0, max=hrefs.length; i<max; i++) {
if (hrefs[i].href.indexOf(localdomain) == -1) {
hrefs[i].target='_blank';
}
};
// -->
</script>

Just change link-o-rama.com to your domain & put this above the </body> tag :)

Thanks for that bit of code. I have a good use for it. |thumb