Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript to redirect to page

Status
Not open for further replies.

sun9

Programmer
Dec 13, 2006
31
US
hi,

I am trying to redirect the user to another page using window.location when a particular condition is satisfied, e.g: the page the user comes from matches a certain criteria but for some reason I cannot get the page to redirect to the new location instead it just shows the current page where the redirection code is. The condition I am checking is satisfied as when I place alerts inside the if clause it brings up an alert button, I even tried window.location.replace but even that doesnt work.I am not sure what I am doing wrong here any help is greatly appreciated.
Code:
if((referringpage.indexOf("XXXXXXX") >= 0)){
 alert("inside if clause");
 window.location = "[URL unfurl="true"]http://www.yahoo.com"[/URL] ;
  }//if
 
The referring page is passed as a url parameter which i retrieve using another javascript function.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top