PDA

View Full Version : Javascript links


Gregsta
05-02-2004, 09:42/09:42AM
Hi there,
Is it possible to create a link in javascript so it wont be spidered by search engines?

Thanks

Greg

Bobn
25-02-2004, 08:21/08:21AM
Hi Gregsta,

Sorry for the late reply- only just noticed this one...

Place this one in script tags in the head of the document

<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->

-------

this is the code that enables the link on page, place in body content as per normal

<span onClick="MM_goToURL('parent','http://www.ihelpyouservices.com/forums');return document.MM_returnValue">link</span>

You can do a tricksie little move here also but I feel it isn't a very nice this to do...If you encode the word that you want the link to be as a standard a href hyperlink you can have a javascripted destination page and a text based destination page, this will make site user that have javascript enable go to the URL in the javascript element but text browsers (spiders for example) go to the a href link, also the href page address will be shown as the page destination in the browser textbar(foot of browser (ie))...

Fake hyper link and javascript goto-URL

<a href="../page.htm" onClick="MM_goToURL('parent','http://www.ihelpyouservices.com/forums');return document.MM_returnValue">link</a>

From my point of view I dislike this technique is it is used to plant the site users to a different domain but can be of use for guiding users to a conversion point but please be ethical in it use as I have seen this or a simular method used to fool users into clicking a CPC/PPC link redirect therefor inflating revenue.

another method is to simply place a robots meta tag on the target page with a noindex/follow statment set, the spider will see the page but will not index the page but will follow any links therein...

laters...

Gregsta
30-03-2004, 07:19/07:19AM
Hi Bob,
I have only just gotten around to implemeting some JS links. Thanks for the code you gave me but I was trying to something elase slightly different with JS links.

If you imagine a homepage a reservoir of pagerank and each link is a gate that lets the pagerank out. What I want to do is close certain gates to the search engines and leave others open therefore channeling the pagerank to other webpages that are more important for my rankings.

What I have so far is this:

<!--
var addr1="http://www."
var addr2="axiossystems.com/"
var addr3="page1.php"
document.write('<\a href="" + addr1 + addr2 + addr3 + "">')
document.write('page1<\/a>')
//-->

but it isnt working. I was wondering if you had any ideas on how I can debug this code (Im still a newbie) or am I in completely the wrong area?

Thanks

Greg

Bobn
30-03-2004, 07:38/07:38AM
Hi Gregsta,

Fixed that for you, just a few minor errors but they are common mistakes to make...

Place this in the head of your html page...

<script>
var addr1="http://www.";
var addr2="axiossystems.com/";
var addr3="page1.php";
</script>

Place this in the body of your html page...

<script>
document.write('<a href="' + addr1 + addr2 + addr3 + '">page1<\a>')
</script>


To summarise the fix...Single quote for the document.write and splitting the script helps with making the trick more convincing, one small issue though is the fact that the link may still be spiderable...but don't quote me...

Hope this solves your problem, in addition you could add a infinite bunch of possible links by adding more addr numbers...to increase the link potential...Love the idea...

Laters

polarmate
30-03-2004, 11:58/11:58AM
Questions for you, Gregsta:
What is it about these links that you don't want search engines to follow them but you do want humans to follow?

If these are links to your stats pages and stuff, that is something that can be handled using robots.txt and excluding the page.

If it is about PR then Google is getting wise to PR hoarding tactics and is beginning to extract and follow links in javascripts. A bunch of us recently noticed a bot that came from Google's IP block that *only* grabbed js files after peeking into robots.txt.