URL Redirect Javascript

This question already has an answer here:

  • How do I redirect to another webpage? 67 answers

  • 使用location.href

    window.location.href = email;
    

    window.location.href = email;
    

    应该将用户重定向到email包含的URL


    你可以设置window.location.href:

    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://') != 0)
             {
                alert("Not valid Web Address");
                keepGoing = true;
             }
    
             //if nothing was entered
             else if(email == '')
             {
                var email = prompt("Please Enter Valid Web Address");
             }
    
             else
             {
                window.location.href=email;
             }       
    
        }
     }
    
    链接地址: http://www.djcxy.com/p/1952.html

    上一篇: 重定向到相同的页面来锚定

    下一篇: URL重定向Javascript