URL Redirect Javascript? I have am trying to redirect an entered web address with a http:// and prompt until a http:// is found and if it is found it will direct it to the website that is entered.
Heres my code so far:
function enter() {
var keepGoing = true;
var email;
while (keepGoing) {
keepGoing = false
email = prompt("Please Enter Website Address");
// Website Address validation to see if it has http://
if (email.indexOf('http://') === -1) {
alert("Not valid Web Address");
keepGoing = true;
}
// if nothing was entered
else if (email == '') {
var email = prompt("Please Enter Valid Web Address");
}
}
}