[英]How to change full URL in address bar without reloading page?
Current URL: "www.example.com/dashboard/test"
当前 URL:
"www.example.com/dashboard/test"
I want to change: "www.example.com/task/5"
我想改变:
"www.example.com/task/5"
I've tried:我试过了:
var browserState = {Url: "www.example.com/task/5" };
history.pushState(browserState, "", browserState.Url);
Ref: https://developer.mozilla.org/en-US/docs/Web/API/History_API#examples参考: https://developer.mozilla.org/en-US/docs/Web/API/History_API#examples
I've seen many example.我见过很多例子。 But all where, just changed the parameter.
但是所有的地方,只是改变了参数。 But I want to change the full url. Please someone help.
但我想更改完整的url。请有人帮忙。 Thanks in advance.
提前致谢。
I think what you are trying to achieve is not practically possible.我认为您要实现的目标实际上是不可能的。
If you want to change a url that will always redirect to the website.如果你想改变一个 url 总是重定向到该网站。
You can embed the website if you want to stay in the same website.如果你想留在同一个网站,你可以嵌入该网站。 You can use iframe
您可以使用 iframe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.