Path Specific Re-direction using JavaScript

Saturday, December 26th, 2009

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>
<script language="JavaScript">
var currentpage=location.href;
var spage="";
 setTimeout("location.href = '';",10000);

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