我有这个网址:
我想将其更改为其他内容而不更改页面:
这可能吗?如果是请告诉我代码
最佳答案
您需要使用pushState或replaceState方法
window.history.pushState(null, null, "/your-new-url");
或者
window.history.replaceState(null, null, "/another-new-url");
关于javascript - 如何覆盖网址?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32832521/