如何让浏览器浏览到JavaScript中的URL?(How to get the browser to navigate to URL in JavaScript [duplicate])
这个问题已经在这里有一个答案:
如何重定向到另一个网页? 70个答案什么是最好的(正确的,现代的,跨浏览器的,安全的)方式来使网页浏览器使用Javascript导航到您选择的URL?
This question already has an answer here:
How do I redirect to another webpage? 58 answersWhat is the best (correct, modern, cross-browser, safe) way to get a web browser to navigate to a URL of your choice using JavaScript?
最满意答案
这适用于所有浏览器:
window.location.href = '...';如果您希望在浏览器浏览器历史记录中反映该页面,您可以进行以下操作:
window.location.replace('...');This works in all browsers:
window.location.href = '...';If you wanted to change the page without it reflecting in the browser back history, you can do:
window.location.replace('...');更多推荐
发布评论