【发布时间】:2020-04-20 16:27:39
【问题描述】:
我想知道如何在不重新加载页面或更改页面内容的情况下更改页面URL。 我已经使用了该代码(JavaScript):
if(history.pushState){
window.history.pushState("object or string", "Title", "/");
}else{
document.location.href = "/";
}
但它并不适用于所有浏览器,并且 Firefox 将其标记为 insecure。 有没有其他方法可以在 JavaScript/jQuery/.htaccess/HTML 元标记
编辑:
(1):我想要一个不使用window.history.pushState的答案
(2): strong> 这些答案无济于事:
how to chage url without redirect in javascript?
, How do I modify the URL without reloading the page?
【问题讨论】:
-
不,没有
-
你检查过这个吗? stackoverflow.com/questions/824349/…
-
我想要一些不包含
window.history.pushState的东西,因为它不安全
标签: javascript jquery html .htaccess meta