【发布时间】:2020-06-20 20:25:20
【问题描述】:
我需要一些帮助。 我想更改地址栏内容,但我需要替换整个地址,包括 www.site.com/(domain)
我尝试一下:
window.history.pushState("object or string", "Title", "new-url");
但没有成功。请帮忙?
谢谢
【问题讨论】:
-
我认为你应该使用 replaceState
-
您不能使用 History API 将 URL 更改为另一个域的 URL。
-
使用角度路由器功能
-
@HarshKanakhara 你在哪里看到使用 Angular 的 OP?
标签: javascript html