Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Java Script Redirect (See related posts)

<script language="JavaScript">
<!--
window.location="http://www.anotherpage.com/";
// -->
</script>


Alternately, something like..

<a href="#" onclick="window.location='http://www.something.com/';" return false;">Click here</a>


which stops it from being indexed (although rel="noindex" does the same on some engines).

Comments on this post

ddfreyne posts on Apr 03, 2006 at 13:20
Why would you want a JavaScript redirect? For users without JavaScript, or with JavaScript turned off, there's no way to follow the link. This is not a very accessible solution.

If you want to stop a certain page from being indexed, put it into robots.txt.
peter posts on Apr 03, 2006 at 16:42
I'll come clean on this one. I'm doing an experiment to see if this attracts traffic from search results, because I'm trying to come up with ways to boost the userbase here.

But yeah, it's not the most useful code I'll admit.

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts