I have two domains as: project1.com
and project2.com
. The latter contains a subdomain as login.project2.com
. I need to redirect a user to this place, i.e. login.project2.com
from the former based on his input. (Don't ask about the logic, or as to why I do this, it is simply because I have been asked to do).
I have tried the following:
function redirectToPage() {
if (someVar == someValue) {
document.location = 'http://www.login.project2.com'; // does not work
document.location = 'www.login.project2.com'; // does not work
document.location = 'http://login.project2.com'; // does not work
document.location = 'login.project2.com'; // inval
//only of the above is left uncommented at a time
}
}
But, when I type the fourth one directly in the address bar, it leads me to the desired page. Where am I wrong?