[英]how to replace and load a new url that is entered by a user
尝试这个:
var website = prompt("enter a website");
window.location.href = website;
您可以使用window.location.replace()
方法。
简单的解决方案将使用
document.location.href
例
document.location.href="https://flinkhub.com"
请记住在网站名称之前添加http://或https://,以进行正确的重定向,否则它将添加到现有的url中。
希望它能解决您的问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.