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.
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