URL重定向Javascript?我正在尝试使用 http:// 重定向输入的网址并提示直到找到 http://,如果找到它会将其定向到输入的网站。
到目前为止,这是我的代码:
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");
}
}
}