Tuesday, February 17, 2009

Redirect a page URL in javascript

The following code will redirect a page from index.aspx to the root URL in javascript:

var u = 'http://www.mysite.com/';
if (self.parent.frames.length != 0) self.parent.location=u;
if (self.location != u) self.location=u;//