Path Specific Re-direction using JavaScript

Path Specific Re-direction using JavaScript

You might have seen and used lot of JavaScript redirection before. What sets this JavaScript apart from others is that it redirects to a new location only on chosen page. This can come in handy if you don’t have access to sever-sided scripting, which is usually used for such path/URL specific re-direction. Like most of the weblogs – blogger, Wordpress MU, etc.

<!--Path Specific Re-direction from www.thepixelart.com-->
<script language="JavaScript">
var currentpage=location.href;
var spage="http://pixelart.com/web";
if(currentpage==spage)
 setTimeout("location.href = 'http://www.example.com';",10000);
</script>

Here “spage” is the page which needs to be redirected to new location. www.example.com represents the new location and the number “10000” is the time delay.

 
View