[thelist] window.self question

Jeff Howden jeff at jeffhowden.com
Mon Nov 24 13:32:10 CST 2003


> From: michael grover
> Certain paid-for links on my site are getting hammered
> by spiders.  I have the idea that I can hide the links
> behind javascript and thwart the more stupid spiders.
> But, I can't figure out how to use javascript in such
> a way that it won't go about opening a new window.
> Here's what I start with:
> <a href="#" onClick="window.open('target_page.html','');
>    return false;">Paid-for link</a>.
> Now, I thought that I could change window.open to
> window.self and I'd be just fine.  But, it doesn't
> do it.
> Any ideas?  Or, any other ideas for how I can obfuscate
> these links from  spiders while still making them
> usable by humans?

you've got a couple of options, each with their own set of disadvantages.

1) use javascript (location.href) in the onclick
   event handler.

2) use a redirect script in it's own directory
   and a robots.txt file with bot exclusion.

the disadvantage to the first option is that users without javascript won't
be able to use the link.

the disadvantage to the second option is that bots that don't obey
robots.txt exclusions will still follow the links.  this can be overcome
though with some logic to trap for user agents in a black list you maintain.


Jeff Howden - Web Application Specialist
Resume - http://jeffhowden.com/about/resume/
Code Library - http://evolt.jeffhowden.com/jeff/code/

More information about the thelist mailing list