如何替换整个 URL,然后使用用户在提示中输入的新 URL 替换并加载它,此时我已经完成了
var website = prompt("enter a website");
document.location.href.replace = 网站;
我尝试过一次不同的方法,但它添加了我已有的 URL。我想要替换整个网址 the url that needs to replaced
谢谢
最佳答案
试试这个:
var website = prompt("enter a website");
window.location.href = website;
关于javascript - 如何替换并加载用户输入的新网址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48571111/