noslenwerd
Programmer
Hey all im a noob to the forums
Anyways, we are running a website with 2 different URLs, but the same exact content/IP and files. I started working on this js that will redirect users depending on which URL they enter through. Basically a company changed thier name, and wants users to go to a page (that i already created) that lets the user know the have changed thier name and website, then redirect them to the new URL.
But if they just go right to the correct/new URL, it just takes them to the index.asp file. And obviously i cant just make the page i created for the redirection and name it index.asp because it will change on both sites...
Here is the code i have so far, it is checking which URL they entered (the old one is and the other begins with hence the checking for the 'n' and 'r'). Problem is i need the syntax to actually send the person to the redirect.asp file when they enter the old url, and index.asp when they enter the new URL). What do I need to put in the if statements of my ItemChoser function, and also what what syntax should i put into the index.asp file if any?
Here is the code that i have so far...
function whichDomain()
{ var webAddress = location.hostname;
if (webAddress.substring(0,4) == " {
if(webAddress.substring(5,6)=="n")
{
return "n";
}
if(webAddress.substring(5,6)=="r")
{
return "r";
}
} // end if www
else
{
if(webAddress.substring(1,2)=="n")
{
return "n";
}
if(webAddress.substring(1,2)=="r")
{
return "r";
}
}
}
function itemChooser(pageItem){
var returnString;
if(whichDomain()=="n")
{
if (pageItem == "?")
{
returnString = "?";
}
}else{
if (pageItem == "?")
{
returnString = "?";
}
}
return returnString;
}
Thanks!!!
Anyways, we are running a website with 2 different URLs, but the same exact content/IP and files. I started working on this js that will redirect users depending on which URL they enter through. Basically a company changed thier name, and wants users to go to a page (that i already created) that lets the user know the have changed thier name and website, then redirect them to the new URL.
But if they just go right to the correct/new URL, it just takes them to the index.asp file. And obviously i cant just make the page i created for the redirection and name it index.asp because it will change on both sites...
Here is the code i have so far, it is checking which URL they entered (the old one is and the other begins with hence the checking for the 'n' and 'r'). Problem is i need the syntax to actually send the person to the redirect.asp file when they enter the old url, and index.asp when they enter the new URL). What do I need to put in the if statements of my ItemChoser function, and also what what syntax should i put into the index.asp file if any?
Here is the code that i have so far...
function whichDomain()
{ var webAddress = location.hostname;
if (webAddress.substring(0,4) == " {
if(webAddress.substring(5,6)=="n")
{
return "n";
}
if(webAddress.substring(5,6)=="r")
{
return "r";
}
} // end if www
else
{
if(webAddress.substring(1,2)=="n")
{
return "n";
}
if(webAddress.substring(1,2)=="r")
{
return "r";
}
}
}
function itemChooser(pageItem){
var returnString;
if(whichDomain()=="n")
{
if (pageItem == "?")
{
returnString = "?";
}
}else{
if (pageItem == "?")
{
returnString = "?";
}
}
return returnString;
}
Thanks!!!